Class Account

java.lang.Object
com.jk.core.jpa.JKBaseEntity
com.jk.webstack.services.account.Account
All Implemented Interfaces:
Serializable, org.springframework.security.core.userdetails.UserDetails

@Entity public class Account extends JKBaseEntity implements org.springframework.security.core.userdetails.UserDetails, Serializable
This class represents user account information in a web application.

It extends JKBaseEntity and implements UserDetails and Serializable interfaces.

Version:
1.0
Author:
Dr. Jalal H. Kiswani
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Account
    This method creates a new Account.
    email(String email)
    This method sets the user account email address to the provided value.
    firstname(String firstname)
    This method sets the user account first name to the provided value.
    Collection<? extends org.springframework.security.core.GrantedAuthority>
    This method is yet to be implemented (TBI).
    This method gets the user account user name.
    boolean
    Indicates whether the user's account has expired.
    boolean
    Indicates whether the user is locked or unlocked.
    boolean
    Indicates whether the user's credentials (password) has expired.
    boolean
    Indicates whether the user is enabled or disabled.
    boolean
    This method checks whether the token has expired or not.
    lastname(String lastname)
    This method sets the user account last name to the provided value.
    void
    This method is invoked before the entity is persisted (inserted) into the database.
    void
    This method is invoked before the entity is updated in the database.

    Methods inherited from class com.jk.core.jpa.JKBaseEntity

    equals, postUpdate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.security.core.userdetails.UserDetails

    getPassword
  • Constructor Details

    • Account

      public Account()
  • Method Details

    • create

      public static Account create()
      This method creates a new Account.
      Returns:
      the newly created user account.
    • email

      public Account email(String email)
      This method sets the user account email address to the provided value.
      Parameters:
      email - Specifies the user account email address.
      Returns:
      the edited account instance.
    • firstname

      public Account firstname(String firstname)
      This method sets the user account first name to the provided value.
      Parameters:
      firstname - Specifies the user account first name.
      Returns:
      the edited account instance.
    • lastname

      public Account lastname(String lastname)
      This method sets the user account last name to the provided value.
      Parameters:
      lastname - Specifies the user account last name.
      Returns:
      the edited account instance.
    • getAuthorities

      public Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities()
      This method is yet to be implemented (TBI).
      Specified by:
      getAuthorities in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      null.
    • getUsername

      public String getUsername()
      This method gets the user account user name.
      Specified by:
      getUsername in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      the user account user name.
    • isAccountNonExpired

      public boolean isAccountNonExpired()
      Indicates whether the user's account has expired.

      An expired account cannot be authenticated.

      Specified by:
      isAccountNonExpired in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      true if the user's account is valid (non-expired), false if no longer valid (expired).
    • isAccountNonLocked

      public boolean isAccountNonLocked()
      Indicates whether the user is locked or unlocked.

      A locked user cannot be authenticated.

      Specified by:
      isAccountNonLocked in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      true if the user is not locked, false otherwise.
    • isCredentialsNonExpired

      public boolean isCredentialsNonExpired()
      Indicates whether the user's credentials (password) has expired.

      Expired credentials prevent authentication.

      Specified by:
      isCredentialsNonExpired in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      true if the user's credentials are valid (non-expired), false if no longer valid (expired).
    • isEnabled

      public boolean isEnabled()
      Indicates whether the user is enabled or disabled.

      A disabled user cannot be authenticated.

      Specified by:
      isEnabled in interface org.springframework.security.core.userdetails.UserDetails
      Returns:
      true if the user is enabled, false otherwise.
    • isTokenExpired

      public boolean isTokenExpired()
      This method checks whether the token has expired or not.
      Returns:
      true, if the token has expired, false otherwise.
    • prePersist

      public void prePersist()
      This method is invoked before the entity is persisted (inserted) into the database.

      This method initializes the creation and modification dates with the current date and time.

      Overrides:
      prePersist in class JKBaseEntity
    • preUpdate

      public void preUpdate()
      This method is invoked before the entity is updated in the database.

      This method updates the modification date with the current date and time.

      Overrides:
      preUpdate in class JKBaseEntity