R - the generic typeT - the generic type@Transactional(readOnly=true) public abstract class BasicUserServiceImpl<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>> extends Object implements BasicUserService<R,T>
| Modifier and Type | Field and Description |
|---|---|
protected AclEntryPersistence |
aclEntryRepository |
static org.slf4j.Logger |
LOG
The Constant LOG.
|
protected org.springframework.security.crypto.password.PasswordEncoder |
passwordEncoder
The password encoder.
|
| Constructor and Description |
|---|
BasicUserServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
assureGoodPassword(String password)
Test if password passes the password policy (if set).
|
T |
changePassword(T user,
String password)
Change password.
|
T |
deepLoad(T user) |
void |
deleteUser(T user)
Try to delete user.
|
abstract R |
getDefaultUserRole()
Gets the default user role.
|
T |
getUser(long id)
Get User by id.
|
abstract List<R> |
listAvailableRoles()
List available roles.
|
org.springframework.security.core.userdetails.UserDetails |
loadUserByUsername(String username) |
void |
setAccountLock(long userId,
boolean locked)
Sets the account lock.
|
void |
setAccountLockLocal(long userId,
boolean locked)
For internal use only.
|
void |
setAccountLockoutTime(long accountLockoutTime)
Sets the account lockout time.
|
T |
setAccountType(T user,
BasicUser.AccountType accountType)
Sets the account type.
|
protected void |
setPassword(T user,
String password)
Sets the password.
|
T |
setRoles(T user,
Set<R> newRoles)
Grant specified roles to user.
|
T |
updateUser(T user,
String email,
String fullName)
Update user information.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateUser, getUserByEmailpublic static final org.slf4j.Logger LOG
@Autowired(required=false) protected final org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
@Autowired(required=false) protected AclEntryPersistence aclEntryRepository
public void setAccountLockoutTime(long accountLockoutTime)
accountLockoutTime - the new account lockout timepublic abstract R getDefaultUserRole()
BasicUserServicegetDefaultUserRole in interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>>public abstract List<R> listAvailableRoles()
BasicUserServicelistAvailableRoles in interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>>public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException
loadUserByUsername in interface org.springframework.security.core.userdetails.UserDetailsServiceorg.springframework.security.core.userdetails.UsernameNotFoundExceptionpublic T getUser(long id)
BasicUserService@Transactional @PreAuthorize(value="hasRole(\'ADMINISTRATOR\') || principal.id == #user.id") public T updateUser(T user, String email, String fullName) throws NotUniqueUserException, UserException
BasicUserServiceupdateUser in interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>>user - the useremail - new email addressfullName - new fullNameNotUniqueUserException - when email address is already registeredUserException - a generic user service exception@Transactional @PreAuthorize(value="hasRole(\'ADMINISTRATOR\')") public void deleteUser(T user)
BasicUserServicedeleteUser in interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>>user - user to delete@Transactional @PreAuthorize(value="hasRole(\'ADMINISTRATOR\')") public T setRoles(T user, Set<R> newRoles)
BasicUserServiceBasicUserService.getDefaultUserRole() will be
added if missing.@Transactional @PreAuthorize(value="hasRole(\'ADMINISTRATOR\') || principal.id == #user.id") public T changePassword(T user, String password) throws PasswordPolicy.PasswordPolicyException
BasicUserServicechangePassword in interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>>user - the userpassword - new passwordPasswordPolicy.PasswordPolicyException - the password policy exceptionprotected void setPassword(T user, String password) throws PasswordPolicy.PasswordPolicyException
user - the userpassword - the passwordPasswordPolicy.PasswordPolicyException - the password policy exceptionpublic void assureGoodPassword(String password) throws PasswordPolicy.PasswordPolicyException
password - candidate passwordPasswordPolicy.PasswordPolicyException - if password does not match policy@Transactional
public void setAccountLockLocal(long userId,
boolean locked)
throws NoUserFoundException
setAccountLockLocal in interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>>userId - the user idlocked - the lockedNoUserFoundException - the no user found exception@Transactional
@PreAuthorize(value="hasRole(\'ADMINISTRATOR\')")
public void setAccountLock(long userId,
boolean locked)
throws NoUserFoundException
BasicUserServicesetAccountLock in interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>>userId - the user idlocked - the lockedNoUserFoundException - the no user found exception@Transactional public T setAccountType(T user, BasicUser.AccountType accountType)
BasicUserServicesetAccountType in interface BasicUserService<R extends org.springframework.security.core.GrantedAuthority,T extends BasicUser<R>>user - the useraccountType - the account typeCopyright © 2018 Global Crop Diversity Trust. All rights reserved.