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 boolean
Whether to allow username change while setting the password or not.default void
Carry out the secured action.static int
Generates a 6-digit One-Time Password (OTP).static String
Generate a prefix with a specific format.default String
getEmail()
Get the email of this user.default String
Get the site to go when password is successfully set.default String
Get the message to be shown when a "password change" fails.default String
Get the mobile number of this user.default String
Get the "error message" to be shown when failed to send OTP due to technical errors.default String
Get the "exit site" to exit the application when failed to send OTP due to technical errors.default String
Get the OTP tag that needs to be used when sending OTP.default String
Get the template t be used when sending OTP messages while verifying.default int
Get the OTP timeout in seconds.default String
Get the caption used when changing the password.default String
Get the message to be shown when a "password change" is done successfully.getUser()
Get the user to identify.default boolean
Check whether the same OPT should be sent to both email and mobile for verification.default void
This method is invoked when a "password change" fails.default void
This method is invoked when a "password change" is carried out successfully.void
setUser
(SystemUser user) Set the user to identify.default boolean
Whether 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 returntrue
so 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.
-