Interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>>
- Type Parameters:
R- the generic typeT- 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 Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionchangePassword(T user, String password) Change password.createUser(String email, String fullName, String password, BasicUser.AccountType accountType) Create a new user account.voiddeleteUser(T user) Try to delete user.Get default roles assigned to users.getUser(long id) Get User by id.getUserByEmail(String email) Get User by email.List available roles.voidsetAccountLock(long userId, boolean locked) Sets the account lock.voidsetAccountLockLocal(long userId, boolean locked) Lock user account.setAccountType(T user, BasicUser.AccountType accountType) Sets the account type.Grant specified roles to user.voidupdateLastLogin(String userName) Update user's last login timestamp on successful login.updateUser(T user, String email, String fullName) Update user information.Methods inherited from interface org.springframework.security.core.userdetails.UserDetailsService
loadUserByUsername
-
Field Details
-
SYSTEM_ADMIN
The system admin.- See Also:
-
-
Method Details
-
getUser
Get User by id.- Parameters:
id- the id- Returns:
- the user or
null
-
getUserByEmail
Get User by email.- Parameters:
email- the email- Returns:
- the user
-
createUser
T createUser(String email, String fullName, String password, BasicUser.AccountType accountType) throws NotUniqueUserException, PasswordPolicy.PasswordPolicyException, UserException Create a new user account.- Parameters:
email- unique email addressfullName- Full namepassword- initial account passwordaccountType- account type- Returns:
- the new user
- Throws:
NotUniqueUserException- user is not unique in the systemPasswordPolicy.PasswordPolicyException- password violates current password policyUserException- any other exception
-
setRoles
Grant specified roles to user. ThegetDefaultUserRoles()will not be persisted.- Parameters:
user- the userroles- the roles- Returns:
- the updated user
-
updateUser
Update user information.- Parameters:
user- the useremail- new email addressfullName- new fullName- Returns:
- the updated user
- Throws:
NotUniqueUserException- when email address is already registeredUserException- a generic user service exception
-
changePassword
Change password.- Parameters:
user- the userpassword- new password- Returns:
- the updated user
- Throws:
PasswordPolicy.PasswordPolicyException- the password policy exception
-
deleteUser
Try to delete user.- Parameters:
user- user to delete
-
setAccountLockLocal
Lock user account.- Parameters:
userId- the user idlocked- Is account locked- Throws:
NoUserFoundException- the no user found exception
-
setAccountLock
Sets the account lock.- Parameters:
userId- the user idlocked- the locked- Throws:
NoUserFoundException- the no user found exception
-
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
Sets the account type.- Parameters:
user- the useraccountType- the account type- Returns:
- the t
-
updateLastLogin
Update user's last login timestamp on successful login.- Parameters:
userName- the user name- Throws:
NoUserFoundException- if username not found in the system
-