Class DuracloudUserServiceImpl
java.lang.Object
org.duracloud.account.db.util.impl.DuracloudUserServiceImpl
- All Implemented Interfaces:
DuracloudUserService,org.springframework.security.core.userdetails.UserDetailsService
@Component("duracloudUserService")
public class DuracloudUserServiceImpl
extends Object
implements DuracloudUserService, org.springframework.security.core.userdetails.UserDetailsService
- Author:
- Andrew Woods Date: Oct 9, 2010
-
Constructor Summary
ConstructorsConstructorDescriptionDuracloudUserServiceImpl(org.duracloud.account.db.repo.DuracloudRepoMgr duracloudRepoMgr, NotificationMgr notificationMgr, AmaEndpoint amaEndpoint, org.duracloud.common.changenotifier.AccountChangeNotifier accountChangeNotifier, EmailTemplateService emailTemplateService) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddUserToAccount(Long acctId, Long userId) This method sets the roles of a user in an account.voidchangePassword(Long userId, String oldPassword, boolean oldPasswordEncoded, String newPassword) This method changes the password of the user with the arg userId from the oldPassword to the newPassword.voidchangePasswordInternal(Long userId, String oldPassword, boolean oldPasswordEncoded, String newPassword) voidcheckUsername(String username) This method throws an exception is the username is non-unique or it is not a valid username.org.duracloud.account.db.model.DuracloudUsercreateNewUser(String username, String password, String firstName, String lastName, String email, String securityQuestion, String securityAnswer) This method creates and persists a new user.voidforgotPassword(String username, String securityQuestion, String securityAnswer) This method generates a random password, replaces the existing password with the randomly generated one, and sends an email to the address on file for the given username.org.duracloud.account.db.model.DuracloudUserloadDuracloudUserByIdInternal(Long userId) org.duracloud.account.db.model.DuracloudUserloadDuracloudUserByUsername(String username) This method loads a DuracloudUser from the persistence layer and populate its rights info.org.duracloud.account.db.model.DuracloudUserloadDuracloudUserByUsernameInternal(String username) org.springframework.security.core.userdetails.UserDetailsloadUserByUsername(String username) redeemAccountInvitation(Long userId, String redemptionCode) This method redeems an invitation to add this user to a DuraCloud account.voidredeemPasswordChangeRequest(Long userId, String redemptionCode) org.duracloud.account.db.model.UserInvitationretrievePassordChangeInvitation(String redemptionCode) Returns a user password change invitationvoidrevokeUserRights(Long acctId, Long userId) This method removes all rights to an account for a given user.booleansetUserRights(Long acctId, Long userId, org.duracloud.account.db.model.Role... roles) This method sets the roles of a user in an account.voidstoreUserDetails(Long userId, String firstName, String lastName, String email, String securityQuestion, String securityAnswer, String allowableIPAddressRange) This method persists the arg user details.
-
Constructor Details
-
DuracloudUserServiceImpl
@Autowired public DuracloudUserServiceImpl(org.duracloud.account.db.repo.DuracloudRepoMgr duracloudRepoMgr, NotificationMgr notificationMgr, AmaEndpoint amaEndpoint, org.duracloud.common.changenotifier.AccountChangeNotifier accountChangeNotifier, EmailTemplateService emailTemplateService)
-
-
Method Details
-
checkUsername
public void checkUsername(String username) throws InvalidUsernameException, UserAlreadyExistsException Description copied from interface:DuracloudUserServiceThis method throws an exception is the username is non-unique or it is not a valid username.- Specified by:
checkUsernamein interfaceDuracloudUserService- Parameters:
username- sought- Throws:
InvalidUsernameExceptionUserAlreadyExistsException
-
createNewUser
public org.duracloud.account.db.model.DuracloudUser createNewUser(String username, String password, String firstName, String lastName, String email, String securityQuestion, String securityAnswer) throws UserAlreadyExistsException, InvalidUsernameException Description copied from interface:DuracloudUserServiceThis method creates and persists a new user.- Specified by:
createNewUserin interfaceDuracloudUserService- Parameters:
username- of new userpassword- of new userfirstName- of new userlastName- of new useremail- of new usersecurityQuestion- of new usersecurityAnswer- of new user- Returns:
- DuracloudUser
- Throws:
UserAlreadyExistsExceptionInvalidUsernameException
-
setUserRights
public boolean setUserRights(Long acctId, Long userId, org.duracloud.account.db.model.Role... roles) Description copied from interface:DuracloudUserServiceThis method sets the roles of a user in an account. Note that this method only sets a user to new roles. To remove a user from an account, use revokeAllRights().- Specified by:
setUserRightsin interfaceDuracloudUserService- Returns:
- true if an update was performed.
-
revokeUserRights
Description copied from interface:DuracloudUserServiceThis method removes all rights to an account for a given user.- Specified by:
revokeUserRightsin interfaceDuracloudUserService- Parameters:
acctId- on which rights will be revokeduserId- of user whose rights will be revoked
-
changePassword
public void changePassword(Long userId, String oldPassword, boolean oldPasswordEncoded, String newPassword) throws DBNotFoundException, InvalidPasswordException Description copied from interface:DuracloudUserServiceThis method changes the password of the user with the arg userId from the oldPassword to the newPassword.- Specified by:
changePasswordin interfaceDuracloudUserService- Parameters:
userId- of user who is seeking a password changeoldPasswordEncoded- flag noting if the password is hashed- Throws:
InvalidPasswordExceptionDBNotFoundException
-
changePasswordInternal
public void changePasswordInternal(Long userId, String oldPassword, boolean oldPasswordEncoded, String newPassword) throws DBNotFoundException, InvalidPasswordException - Specified by:
changePasswordInternalin interfaceDuracloudUserService- Throws:
InvalidPasswordExceptionDBNotFoundException
-
redeemPasswordChangeRequest
public void redeemPasswordChangeRequest(Long userId, String redemptionCode) throws InvalidRedemptionCodeException - Specified by:
redeemPasswordChangeRequestin interfaceDuracloudUserService- Throws:
InvalidRedemptionCodeException
-
forgotPassword
public void forgotPassword(String username, String securityQuestion, String securityAnswer) throws DBNotFoundException, InvalidPasswordException, UnsentEmailException Description copied from interface:DuracloudUserServiceThis method generates a random password, replaces the existing password with the randomly generated one, and sends an email to the address on file for the given username.- Specified by:
forgotPasswordin interfaceDuracloudUserService- Parameters:
username- of user who forgot their passwordsecurityQuestion- of user who forgot their passwordsecurityAnswer- of user who forgot their password- Throws:
InvalidPasswordExceptionUnsentEmailExceptionDBNotFoundException
-
retrievePassordChangeInvitation
public org.duracloud.account.db.model.UserInvitation retrievePassordChangeInvitation(String redemptionCode) throws DBNotFoundException Description copied from interface:DuracloudUserServiceReturns a user password change invitation- Specified by:
retrievePassordChangeInvitationin interfaceDuracloudUserService- Returns:
- Throws:
DBNotFoundException
-
loadUserByUsername
public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException - Specified by:
loadUserByUsernamein interfaceorg.springframework.security.core.userdetails.UserDetailsService- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
-
loadDuracloudUserByUsername
public org.duracloud.account.db.model.DuracloudUser loadDuracloudUserByUsername(String username) throws DBNotFoundException Description copied from interface:DuracloudUserServiceThis method loads a DuracloudUser from the persistence layer and populate its rights info.- Specified by:
loadDuracloudUserByUsernamein interfaceDuracloudUserService- Parameters:
username- of user to load- Returns:
- DuracloudUser
- Throws:
DBNotFoundException
-
loadDuracloudUserByUsernameInternal
public org.duracloud.account.db.model.DuracloudUser loadDuracloudUserByUsernameInternal(String username) throws DBNotFoundException - Specified by:
loadDuracloudUserByUsernameInternalin interfaceDuracloudUserService- Throws:
DBNotFoundException
-
loadDuracloudUserByIdInternal
public org.duracloud.account.db.model.DuracloudUser loadDuracloudUserByIdInternal(Long userId) throws DBNotFoundException - Specified by:
loadDuracloudUserByIdInternalin interfaceDuracloudUserService- Throws:
DBNotFoundException
-
redeemAccountInvitation
public Long redeemAccountInvitation(Long userId, String redemptionCode) throws InvalidRedemptionCodeException Description copied from interface:DuracloudUserServiceThis method redeems an invitation to add this user to a DuraCloud account.- Specified by:
redeemAccountInvitationin interfaceDuracloudUserService- Parameters:
userId- the id of the user which will be added to the account indicated in the invitationredemptionCode- code which was sent to the user as part of the invitation to become part of an account- Returns:
- the account id associated with the newly redeemed invitation.
- Throws:
InvalidRedemptionCodeException
-
storeUserDetails
public void storeUserDetails(Long userId, String firstName, String lastName, String email, String securityQuestion, String securityAnswer, String allowableIPAddressRange) throws DBNotFoundException Description copied from interface:DuracloudUserServiceThis method persists the arg user details.- Specified by:
storeUserDetailsin interfaceDuracloudUserService- Parameters:
userId- of userfirstName- of userlastName- of useremail- of usersecurityQuestion- of usersecurityAnswer- of user- Throws:
DBNotFoundException
-
addUserToAccount
Description copied from interface:DuracloudUserServiceThis method sets the roles of a user in an account. Note that this method only sets a user to new roles. To remove a user from an account, use revokeAllRights().- Specified by:
addUserToAccountin interfaceDuracloudUserService- Returns:
- true if an update was performed.
- Throws:
DBNotFoundException
-