Package org.cyclos.impl.access
Interface OtpHandler
-
public interface OtpHandlerMethods for managing single use passwords for confirming specific actions. Not to be confused with passwords with mode =PasswordMode.OTP.
-
-
Field Summary
Fields Modifier and Type Field Description static intOTP_LENGTHThe length for sent OTP codesstatic intRESEND_SECONDSSeconds to wait before allowing an OTP to be re-sent
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Otpfind(Long id)Finds an OTP by idSet<SendMedium>getAvailableSendMediums()Returns send mediums available for the logged userDategetDate(OtpType type, OtpOwner owner)Returns when the OTP with the given number and type was sent.MobilePhonegetMobilePhone(Otp otp)Returns the mobile phone related to the user of the given OTPSendOtpDatagetSendOtpData()Returns data used to send an OTP for the logged userbooleanhasAvailableSendMediums()Returns true if the logged user has at least one medium to send to the activation code.longremove(OtpType type, OtpOwner owner)Removes any existing OTP for the given type and ownerOtpsendForAccessClientActivation(User user, MobilePhone mobilePhone)Sends an OTP for activating an access client of the given user.RequestActivationResultsendForDeviceActivation(TrustedDevice device, MobilePhone phone)Sends an OTP for activating a trusted device of the given user.OtpsendForForgotPassword(LocateUserResult locate, List<MobilePhone> phones, SendMedium sendMedium)Sends an OTP for forgot password.OtpsendForPhoneVerification(MobilePhone phone)Sends an OTP for verifying a phone.OtpsendForTotpActivation(BasicUser user, MobilePhone phone)Sends an OTP for activating a new TOTP device.OtpsendForWizardRegistration(CustomWizardExecution execution, ConfigurationAccessor groupConfiguration, SendMedium sendMedium, String sendTo)Sends an OTP for validating a registration field during a registration wizard.Otpverify(OtpType type, OtpOwner owner, String value)Checks for an OTP which matches the given type, owner and value.
-
-
-
Field Detail
-
OTP_LENGTH
static final int OTP_LENGTH
The length for sent OTP codes- See Also:
- Constant Field Values
-
RESEND_SECONDS
static final int RESEND_SECONDS
Seconds to wait before allowing an OTP to be re-sent- See Also:
- Constant Field Values
-
-
Method Detail
-
getAvailableSendMediums
Set<SendMedium> getAvailableSendMediums()
Returns send mediums available for the logged user
-
getDate
Date getDate(OtpType type, OtpOwner owner)
Returns when the OTP with the given number and type was sent. When not sent, returns null;
-
getMobilePhone
MobilePhone getMobilePhone(Otp otp)
Returns the mobile phone related to the user of the given OTP
-
getSendOtpData
SendOtpData getSendOtpData()
Returns data used to send an OTP for the logged user
-
hasAvailableSendMediums
boolean hasAvailableSendMediums()
Returns true if the logged user has at least one medium to send to the activation code.
-
remove
long remove(OtpType type, OtpOwner owner)
Removes any existing OTP for the given type and owner
-
sendForAccessClientActivation
Otp sendForAccessClientActivation(User user, MobilePhone mobilePhone)
Sends an OTP for activating an access client of the given user. When phone is null it is assumed it is sent by email.
-
sendForDeviceActivation
RequestActivationResult sendForDeviceActivation(TrustedDevice device, MobilePhone phone)
Sends an OTP for activating a trusted device of the given user. When phone is null it is assumed it is sent by email.
-
sendForForgotPassword
Otp sendForForgotPassword(LocateUserResult locate, List<MobilePhone> phones, SendMedium sendMedium)
Sends an OTP for forgot password.
-
sendForPhoneVerification
Otp sendForPhoneVerification(MobilePhone phone)
Sends an OTP for verifying a phone.
-
sendForTotpActivation
Otp sendForTotpActivation(BasicUser user, MobilePhone phone)
Sends an OTP for activating a new TOTP device. When phone is null, it is sent via email.
-
sendForWizardRegistration
Otp sendForWizardRegistration(CustomWizardExecution execution, ConfigurationAccessor groupConfiguration, SendMedium sendMedium, String sendTo)
Sends an OTP for validating a registration field during a registration wizard.
-
verify
Otp verify(OtpType type, OtpOwner owner, String value) throws ValidationException
Checks for an OTP which matches the given type, owner and value. Adds a before end listener to remove the OTP when running in a READ_WRITE transaction.- Returns:
- the OTP with the given value (i.e. code), never null
- Throws:
ValidationException- when an OTP couldn't be found
-
-