Package com.storedobject.core
Interface IdentityCheck
public interface IdentityCheck
Interface to identify a
SystemUser. This is typically used for carrying out a secured action.- Author:
- Syam
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanWhether to allow username change while setting the password or not.default voidCarry out the secured action.static intGenerates a 6-digit One-Time Password (OTP).static StringGenerate a prefix with a specific format.default StringgetEmail()Get the email of this user.default StringGet the site to go when password is successfully set.default StringGet the message to be shown when a "password change" fails.default StringGet the mobile number of this user.default StringGet the "error message" to be shown when failed to send OTP due to technical errors.default StringGet the "exit site" to exit the application when failed to send OTP due to technical errors.default StringGet the OTP tag that needs to be used when sending OTP.default StringGet the template t be used when sending OTP messages while verifying.default intGet the OTP timeout in seconds.default StringGet the caption used when changing the password.default StringGet the message to be shown when a "password change" is done successfully.getUser()Get the user to identify.default booleanCheck whether the same OPT should be sent to both email and mobile for verification.default voidThis method is invoked when a "password change" fails.default voidThis method is invoked when a "password change" is carried out successfully.voidsetUser(SystemUser user) Set the user to identify.default booleanWhether the OTP-based checking should be skipped or not.
-
Method Details
-
setUser
-
getUser
-
getEmail
Get the email of this user.- Returns:
- Email or null if no email is available.
-
getMobile
Get the mobile number of this user.- Returns:
- Mobile number or null if no mobile number is available.
-
isSingleOTP
default boolean isSingleOTP()Check whether the same OPT should be sent to both email and mobile for verification.- Returns:
- True/false.
-
getOTPTag
Get the OTP tag that needs to be used when sending OTP.- Returns:
- OTP tag. (Default value is "FP").
-
getOTPTemplate
Get the template t be used when sending OTP messages while verifying.- Returns:
- The name of the OTP message template.
-
getOTPExitSite
Get the "exit site" to exit the application when failed to send OTP due to technical errors.- Returns:
- Exit site. (Default is null).
-
getOTPErrorMessage
Get the "error message" to be shown when failed to send OTP due to technical errors. Application will exit after showing this message. (SpecifygetOTPExitSite()if you want to exit to another site).- Returns:
- Error message. (Default is null).
-
getOTPTimeout
default int getOTPTimeout()Get the OTP timeout in seconds.- Returns:
- OTP Timeout. (Default is 180 seconds).
-
passwordChangeSucceeded
default void passwordChangeSucceeded()This method is invoked when a "password change" is carried out successfully. -
getSuccessMessage
Get the message to be shown when a "password change" is done successfully.- Returns:
- Message to display.
-
passwordChangeFailed
default void passwordChangeFailed()This method is invoked when a "password change" fails. -
getFailureMessage
Get the message to be shown when a "password change" fails.- Returns:
- Message to display.
-
getPasswordChangeCaption
Get the caption used when changing the password.- Returns:
- Caption text.
-
allowNameChange
default boolean allowNameChange()Whether to allow username change while setting the password or not.- Returns:
- True/false.
-
getExitSite
-
skipOTP
Whether the OTP-based checking should be skipped or not. A custom implementation of this method can verify the identity of the user through other means and returntrueso that OTP verification can be skipped.- Parameters:
device- Device on which identification process is on.- Returns:
- True/false.
-
doAction
Carry out the secured action.- Parameters:
action- Action to carry out.
-
generatePrefix
Generate a prefix with a specific format. The prefix consists of three random uppercase letters followed by a colon. Certain inappropriate prefixes like "ASS", "FUK", etc., are avoided and regenerated.- Returns:
- A randomly generated prefix in the format "XXX:" where XXX are uppercase letters.
-
generateOTP
static int generateOTP()Generates a 6-digit One-Time Password (OTP).- Returns:
- A randomly generated 6-digit OTP.
-