Interface IMsUserAuthenticationService
public interface IMsUserAuthenticationService
Service interface for handling authentication-related operations on the master server.
- Since:
- 8.4.0
- Author:
- Norman Lorenz
-
Method Summary
Modifier and TypeMethodDescriptionChecks if two-factor authentication is required for the given user.booleanhasReachedMaxTokenLimit(IUser user) Returns whether the user has reached the maximum number of temporary MFA tokens allowed.booleanisMfaRequired(IUser user) Checks if two-factor authentication is required for the given user.refreshMfaTempToken(String token) verifyMfaCode(String code, String tempToken, boolean saveAuthentication) Verifies the provided MFA code against a temporary token.
-
Method Details
-
checkMfa
Checks if two-factor authentication is required for the given user.- Parameters:
user- the user to check- Returns:
- an Optional containing a TwoFactorAuthenticationRequiredDto if two-factor authentication is required, or an empty Optional if it is not required
- Throws:
IllegalArgumentException- if the user is null or not authenticatedUserMfaTempTokenMaxException- if the maximum number of temporary tokens for two-factor authentication has been reached
-
verifyMfaCode
MfaVerificationResultDto verifyMfaCode(String code, String tempToken, boolean saveAuthentication) throws UserMfaTempTokenNotFoundException, UserMfaTempTokenMaxException, UserMfaTempTokenExpiredException Verifies the provided MFA code against a temporary token.- Parameters:
code- the MFA code to verifytempToken- the temporary token associated with the MFA codesaveAuthentication- whether to save the authentication state if the code is valid- Returns:
- an MfaVerificationResultDto containing the result of the verification
- Throws:
UserMfaTempTokenNotFoundException- if the temporary token is not foundUserMfaTempTokenMaxException- if the maximum number of verification attempts for the temporary token has been reachedUserMfaTempTokenExpiredException- if the temporary token has expired
-
isMfaRequired
Checks if two-factor authentication is required for the given user.- Parameters:
user- the user to check- Returns:
- true if two-factor authentication is required, false otherwise
- Throws:
IllegalArgumentException- if the user is null or not authenticated
-
hasReachedMaxTokenLimit
Returns whether the user has reached the maximum number of temporary MFA tokens allowed.- Parameters:
user- the user to check for maximum token limit- Returns:
- true if the user has reached the maximum token limit, false otherwise
- Throws:
IllegalArgumentException- if the user is null or does not have a profile
-
refreshMfaTempToken
-