Activate previously registered account.
Activate account token.
Authenticates user.
Authentication process consists from multiple AuthenticationStepName and is performed in a state machine fashion.
Authentication process state is persisted by AuthenticationSession and FailedAuthenticationAttemptSession.
Transition to next state/step is announced to client via AuthenticationStatus.nextStep. Depending on this,
he needs to provide additional data.
When an error is encountered, it will be set into AuthenticationStatus.error.
In case it is a AuthenticationStatusError.soft error caused by invalid credentials, user can continue authentication from AuthenticationStatus.nextStep.
In case it is a AuthenticationStatusError.hard error, user needs to abort authentication.
When password-less authentication by challenge-response mechanism is used, generated challenge will be sent by AuthenticationStatus.token property.
When authentication completes successfully, only AuthenticationStatus.authenticated property will be present in the authentication status.
The following AuthenticationStatus property combinations might be returned:
Authentication context.
Authentication status.
Change forgotten password.
On successful password change, OnForgottenPasswordChangedHook will be called.
In case any exception is thrown, operation is considered failed, and user needs
to start again account recovery (i.e. obtain a new forgot password token).
This restriction is imposed in order to prevent replay attacks.
The only exception from this rule is when ErrorCodes.SESSION_NOT_FOUND error code is thrown,
as in this case forgot password token wasn't invalidated.
Forgot password token issued by AuthenticationEngine.createForgotPasswordSession procedure.
Token needs to be in plaintext.
New account password.
Changes user password.
After successful changing, OnPasswordChangedHook will be called and then email notification will be sent to user by EmailSender.
In case any exception is thrown, operation is considered failed.
Change password context.
Creates forgot password session and starts account recovery procedure.
Creates forgot password token and sends it via specified sideChannel
.
If account has AccountModel.pubKey, token will be encrypted before being sent to user.
In this case user needs to decrypt token with his Private Key and send plaintext token back to server.
In case any exception is thrown, operation is considered failed.
Important! When account not found err is thrown, REST API should not respond with error, in order to prevent user enumeration, i.e it should respond with ok (something like token was sent to specified email, even if account doesn't exist).
Name of the account field, value of which user remembers.
Value of that field.
Side channel used to send token to user.
User account.
Disable user account.
Important! This operation should be done only by admin, or by application's business logic.
Account id.
Unix timestamp until account will be disabled.
Use {@link UnixTimestamp} or AccountStatus.DISABLED_UNTIL_ACTIVATION to disable account for an undefined amount of time.
String message that contains explanation why account is disabled.
Enable user account.
Important! This operation should be done only by admin.
Account id.
Get failed authentication attempts into user account.
Important! This method has authorization implications. It needs to be called only by authenticated users for their account or by admin.
Account id.
Starting timestamp.
Ending timestamp.
Get successful authentications into user account.
Important! This method has authorization implications. It needs to be called only by authenticated users for their account or by admin.
Account id.
Starting timestamp.
Ending timestamp.
Register user account.
When account is registered, multi factor authentication is disabled.
Depending on the AccountModel.disabledUntil value:
Account to be registered.
Plaintext password needs to be stored in the AccountModel.passwordHash property.
Enable/Disable two factor authentication on the user's account.
When SetTwoFactorAuthenticationContext.password is given, it will be verified against the account one.
If it is not valid, Exception with ErrorCodes.INCORRECT_PASSWORD will be thrown.
If invalid password was provided too many times, Exception with ErrorCodes.ACCOUNT_DISABLED will be thrown.
Important! This method has authorization implications. It needs to be called only by authenticated users for their account.
Account id.
Whether it's enabled or not.
Operation context.
Result of the TwoFactorAuthStrategy.onTwoFactorAuthEnabled method.
Please check the result type of the AuthenticationEngineOptions.twoFactorAuthStrategy that you've chosen
Verifies user password.
Password provided by user.
User account.
Operation context.
Whether password is valid or not.
Authentication Engine manages user authentication and account.