Package org.cyclos.services.access
Interface PasswordService
-
- All Superinterfaces:
Service
- All Known Subinterfaces:
PasswordServiceLocal
- All Known Implementing Classes:
PasswordServiceImpl,PasswordServiceSecurity
public interface PasswordService extends Service
Service for managing a user's passwords
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_PASSWORD_LENGTHMax password length.static intMIN_PASSWORD_LENGTHMin password length.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Stringactivate(@NotNull PasswordTypeVO passwordType)Activates a password whose mode isPasswordMode.GENERATEDcreating a new password for the current user.voidallowActivation(@NotNull PasswordActionDTO params)Allows the given user to activate the given generated and pending passwordvoidchange(@NotNull ChangePasswordDTO dto)Manually changes a passwordvoidchangeForgottenPassword(@NotNull ChangeForgottenPasswordDTO dto)Changes a manual password leaving asPasswordStatus.ACTIVE, or if generated, send a new one (leaving asPasswordStatus.ACTIVEorPasswordStatus.RESETwhether the user has the change permission or not)voiddisable(@NotNull PasswordActionDTO params)Disables a password.voidenable(@NotNull PasswordActionDTO params)Enables a disabled password.ForgotPasswordRequestResponseforgotPasswordRequest(@NotNull ForgotPasswordRequestDTO params)Initiates the forgot password operation, sending a code either by e-mail or SMS to the user.StringgenerateNew(@NotNull ChangeGeneratedPasswordDTO params)Allows to change a generated password by generating a new oneChangeForgottenPasswordDatagetChangeForgottenPasswordData(@NotNull GetChangeForgottenPasswordDataParams params)Returns data for a forgot password change requestChangePasswordDatagetChangePasswordData(boolean changeSecondaryPassword)Returns data for change the main/secondary access password (manual or generated)UserPasswordsDatagetData(@NotNull UserLocatorVO locator)Returns data for user passwordsPasswordDatagetPasswordData(@NotNull UserLocatorVO locator, @NotNull PasswordTypeVO type)Returns data for a given password of the given user.SetSecurityQuestionDatagetSetSecurityQuestionData()Returns data used to set the security questionList<String>requestNewOTP(@NotNull SendMedium medium, String channel)Generates a new OTP (removing any previous password, if any) and sends it by the specified medium using the confirmation mode configured the given channel for the logged user.List<String>requestNewOTPForSecondaryPassword(SendMedium medium)Same asrequestNewOTP(SendMedium, String)but using the secondary password type configured in the current channel for the logged user.voidreset(@NotNull PasswordActionDTO params)Resets the given generated password and allow it to be activated againvoidresetAndSend(@NotNull ResetAndSendPasswordDTO params)Generates a new value of a manual password and send it to the user (for example, via e-mail).voidresetSecurityQuestion(@NotNull UserLocatorVO locator)Resets the security question, forcing the user to set a new one in the next loginvoidsetSecurityQuestion(@NotNull SetSecurityQuestionDTO params)Sets the security question's answer for the logged uservoidunblock(@NotNull PasswordActionDTO params)Unblocks the given user password
-
-
-
Field Detail
-
MIN_PASSWORD_LENGTH
static final int MIN_PASSWORD_LENGTH
Min password length.- See Also:
- Constant Field Values
-
MAX_PASSWORD_LENGTH
static final int MAX_PASSWORD_LENGTH
Max password length.- See Also:
- Constant Field Values
-
-
Method Detail
-
activate
String activate(@NotNull @NotNull PasswordTypeVO passwordType) throws FrameworkException
Activates a password whose mode isPasswordMode.GENERATEDcreating a new password for the current user.- Throws:
IllegalActionException- When the given password type is not generated, or is not in any of the following statuses:FrameworkException
-
allowActivation
void allowActivation(@NotNull @NotNull PasswordActionDTO params) throws FrameworkExceptionAllows the given user to activate the given generated and pending password- Throws:
IllegalActionException- When the given password is not generated / doesn't apply to the given userFrameworkException
-
change
void change(@NotNull @NotNull ChangePasswordDTO dto) throws FrameworkException, PasswordExceptionManually changes a password- Throws:
PasswordException- The current password is invalidValidationException- When the given new password is invalid according to the constraintsIllegalActionException- When the current password cannot be changed (for example, it is generated)FrameworkException
-
changeForgottenPassword
void changeForgottenPassword(@NotNull @NotNull ChangeForgottenPasswordDTO dto) throws FrameworkException, InvalidSecurityAnswerException, PasswordExceptionChanges a manual password leaving asPasswordStatus.ACTIVE, or if generated, send a new one (leaving asPasswordStatus.ACTIVEorPasswordStatus.RESETwhether the user has the change permission or not)
-
disable
void disable(@NotNull @NotNull PasswordActionDTO params) throws FrameworkExceptionDisables a password. A disabled password cannot be used again, unless re-enabled- Throws:
IllegalActionException- When the current password cannot be disabled (for example, is already disabled)FrameworkException
-
enable
void enable(@NotNull @NotNull PasswordActionDTO params) throws FrameworkExceptionEnables a disabled password. A disabled password cannot be used again, unless re-enabled- Throws:
IllegalActionException- When the current password cannot be enabled (not in the disabled state)FrameworkException
-
forgotPasswordRequest
ForgotPasswordRequestResponse forgotPasswordRequest(@NotNull @NotNull ForgotPasswordRequestDTO params) throws FrameworkException, RemoteAddressBlockedException
Initiates the forgot password operation, sending a code either by e-mail or SMS to the user. May also require a security question verification. Returns the e-mail address of phone numbers the code was sent to. The value will be masked if not the same one as requested in the params.
-
generateNew
String generateNew(@NotNull @NotNull ChangeGeneratedPasswordDTO params) throws FrameworkException
Allows to change a generated password by generating a new one- Throws:
FrameworkException
-
getChangeForgottenPasswordData
ChangeForgottenPasswordData getChangeForgottenPasswordData(@NotNull @NotNull GetChangeForgottenPasswordDataParams params) throws FrameworkException, PasswordException
Returns data for a forgot password change request- Throws:
FrameworkExceptionPasswordException
-
getChangePasswordData
ChangePasswordData getChangePasswordData(boolean changeSecondaryPassword) throws FrameworkException
Returns data for change the main/secondary access password (manual or generated)- Throws:
FrameworkException
-
getData
UserPasswordsData getData(@NotNull @NotNull UserLocatorVO locator) throws FrameworkException
Returns data for user passwords- Throws:
FrameworkException
-
getPasswordData
PasswordData getPasswordData(@NotNull @NotNull UserLocatorVO locator, @NotNull @NotNull PasswordTypeVO type) throws FrameworkException
Returns data for a given password of the given user.- Throws:
FrameworkException
-
getSetSecurityQuestionData
SetSecurityQuestionData getSetSecurityQuestionData() throws FrameworkException
Returns data used to set the security question- Throws:
FrameworkException
-
requestNewOTP
List<String> requestNewOTP(@NotNull @NotNull SendMedium medium, String channel) throws FrameworkException, SmsSendingException
Generates a new OTP (removing any previous password, if any) and sends it by the specified medium using the confirmation mode configured the given channel for the logged user. If the channel is null then it use the current channel.- Parameters:
medium- the medium used to send the OTP.channel- the channel used to get the confirmation mode configuration (password type / device)- Returns:
- the email or the normalized phones number the OTP was sent.
- Throws:
SmsSendingException- only if medium isSendMedium.SMSand the OTP could not be sent to any enabled for sms phone.FrameworkException
-
requestNewOTPForSecondaryPassword
List<String> requestNewOTPForSecondaryPassword(SendMedium medium) throws FrameworkException, SmsSendingException
Same asrequestNewOTP(SendMedium, String)but using the secondary password type configured in the current channel for the logged user.
-
reset
void reset(@NotNull @NotNull PasswordActionDTO params) throws FrameworkExceptionResets the given generated password and allow it to be activated again- Throws:
FrameworkException
-
resetAndSend
void resetAndSend(@NotNull @NotNull ResetAndSendPasswordDTO params) throws FrameworkExceptionGenerates a new value of a manual password and send it to the user (for example, via e-mail). If the password is generated, it will be initially active. If it is manual, it will keep the statusPasswordStatus.RESET, forcing the user to change it.- Throws:
FrameworkException
-
resetSecurityQuestion
void resetSecurityQuestion(@NotNull @NotNull UserLocatorVO locator) throws FrameworkExceptionResets the security question, forcing the user to set a new one in the next login- Throws:
FrameworkException
-
setSecurityQuestion
void setSecurityQuestion(@NotNull @NotNull SetSecurityQuestionDTO params) throws FrameworkExceptionSets the security question's answer for the logged user- Throws:
FrameworkException
-
unblock
void unblock(@NotNull @NotNull PasswordActionDTO params) throws FrameworkExceptionUnblocks the given user password- Throws:
IllegalActionException- When the given password is not blocked / doesn't apply to the given userFrameworkException
-
-