Interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>>

Type Parameters:
R - the generic type
T - the generic type
All Superinterfaces:
org.springframework.security.core.userdetails.UserDetailsService
All Known Implementing Classes:
BasicUserServiceImpl

public interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>> extends org.springframework.security.core.userdetails.UserDetailsService
The Interface BasicUserService.
  • Field Details

  • Method Details

    • getUser

      T getUser(long id)
      Get User by id.
      Parameters:
      id - the id
      Returns:
      the user or null
    • getUserByEmail

      T getUserByEmail(String email)
      Get User by email.
      Parameters:
      email - the email
      Returns:
      the user
    • createUser

      Create a new user account.
      Parameters:
      email - unique email address
      fullName - Full name
      password - initial account password
      accountType - account type
      Returns:
      the new user
      Throws:
      NotUniqueUserException - user is not unique in the system
      PasswordPolicy.PasswordPolicyException - password violates current password policy
      UserException - any other exception
    • setRoles

      T setRoles(T user, Set<R> roles)
      Grant specified roles to user. The getDefaultUserRoles() will not be persisted.
      Parameters:
      user - the user
      roles - the roles
      Returns:
      the updated user
    • updateUser

      T updateUser(T user, String email, String fullName) throws NotUniqueUserException, UserException
      Update user information.
      Parameters:
      user - the user
      email - new email address
      fullName - new fullName
      Returns:
      the updated user
      Throws:
      NotUniqueUserException - when email address is already registered
      UserException - a generic user service exception
    • changePassword

      T changePassword(T user, String password) throws PasswordPolicy.PasswordPolicyException
      Change password.
      Parameters:
      user - the user
      password - new password
      Returns:
      the updated user
      Throws:
      PasswordPolicy.PasswordPolicyException - the password policy exception
    • deleteUser

      void deleteUser(T user)
      Try to delete user.
      Parameters:
      user - user to delete
    • setAccountLockLocal

      void setAccountLockLocal(long userId, boolean locked) throws NoUserFoundException
      Lock user account.
      Parameters:
      userId - the user id
      locked - Is account locked
      Throws:
      NoUserFoundException - the no user found exception
    • setAccountLock

      void setAccountLock(long userId, boolean locked) throws NoUserFoundException
      Sets the account lock.
      Parameters:
      userId - the user id
      locked - the locked
      Throws:
      NoUserFoundException - the no user found exception
    • listAvailableRoles

      List<R> listAvailableRoles()
      List available roles.
      Returns:
      the list
    • getDefaultUserRoles

      Collection<R> getDefaultUserRoles()
      Get default roles assigned to users. These are transient and not persisted to the database.
      Returns:
      collection of roles assigned to all users
      Since:
      1.4
    • setAccountType

      T setAccountType(T user, BasicUser.AccountType accountType)
      Sets the account type.
      Parameters:
      user - the user
      accountType - the account type
      Returns:
      the t
    • updateLastLogin

      void updateLastLogin(String userName) throws NoUserFoundException
      Update user's last login timestamp on successful login.
      Parameters:
      userName - the user name
      Throws:
      NoUserFoundException - if username not found in the system