Interface IUserMfaTempTokenDao
- All Known Implementing Classes:
UserMfaTempTokenDao
public interface IUserMfaTempTokenDao
DAO interface for reading and writing
UserMfaTempToken entities.- Since:
- 8.4.0
- Author:
- Norman Lorenz
-
Method Summary
Modifier and TypeMethodDescriptionintDeletes all expired temporary MFA tokens from the database.createNewToken(IEntityContext ec, IUser user) Creates a new temporary MFA token for the specified user.voidbooleandeleteToken(IEntityContext ec, String tokenValue) Deletes a temporary MFA token by its value.getToken(IEntityContext ec, String tokenValue) Retrieves a temporary MFA token by its value.booleanhasReachedMaxTokenLimit(IEntityContext ec, IUser user) Returns whether the user has reached the maximum number of temporary MFA tokens allowed.incrementVerifyAttempts(IEntityContext ec, String tokenValue) Increments the verification attempts for a given temporary MFA token by one.refreshToken(IEntityContext ec, String token)
-
Method Details
-
cleanUpExpiredTokens
Deletes all expired temporary MFA tokens from the database.- Parameters:
ec- the entity context- Returns:
- the number of tokens that were deleted
-
createNewToken
Creates a new temporary MFA token for the specified user.- Parameters:
ec- the entity contextuser- the user for whom the token is created- Returns:
- a new
UserMfaTempTokeninstance - Throws:
IllegalArgumentException- if the user is null or does not have a profileIllegalStateException- if the MFA system settings are invalid or if the user does not have a valid MFA method (e.g. no TOTP method configured or no verified email address)UserMfaTempTokenMaxException- if the maximum number of temporary tokens for the user is exceeded
-
deleteToken
Deletes a temporary MFA token by its value.- Parameters:
ec- the entity contexttokenValue- the value of the token to delete- Returns:
- true if the token was successfully deleted, false if no such token exists
-
getToken
Retrieves a temporary MFA token by its value.- Parameters:
ec- the entity contexttokenValue- the value of the token to retrieve- Returns:
- an
Optionalcontaining theUserMfaTempTokenif found, or empty if not found - Throws:
IllegalArgumentException- if the tokenValue is blank
-
incrementVerifyAttempts
UserMfaTempToken incrementVerifyAttempts(IEntityContext ec, String tokenValue) throws UserMfaTempTokenNotFoundException Increments the verification attempts for a given temporary MFA token by one.- Parameters:
ec- the entity contexttokenValue- the value of the token for which to increment the attempts- Returns:
- the updated
UserMfaTempTokeninstance - Throws:
IllegalArgumentException- if the tokenValue is blankUserMfaTempTokenNotFoundException- if no token with the specified value is found
-
hasReachedMaxTokenLimit
Returns whether the user has reached the maximum number of temporary MFA tokens allowed.- Parameters:
ec- the entity contextuser- 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
-
refreshToken
-
deleteAllTokens
-