Package de.xima.fc.dao.interfaces
Interface IUserMfaTempTokenDao
-
- All Known Implementing Classes:
UserMfaTempTokenDao
public interface IUserMfaTempTokenDaoDAO interface for reading and writingUserMfaTempTokenentities.- Since:
- 8.4.0
- Author:
- Norman Lorenz
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intcleanUpExpiredTokens(IEntityContext ec)Deletes all expired temporary MFA tokens from the database.UserMfaTempTokencreateNewToken(IEntityContext ec, IUser user)Creates a new temporary MFA token for the specified user.voiddeleteAllTokens(IEntityContext ec)booleandeleteToken(IEntityContext ec, String tokenValue)Deletes a temporary MFA token by its value.Optional<UserMfaTempToken>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.UserMfaTempTokenincrementVerifyAttempts(IEntityContext ec, String tokenValue)Increments the verification attempts for a given temporary MFA token by one.UserMfaTempTokenrefreshToken(IEntityContext ec, String token)
-
-
-
Method Detail
-
cleanUpExpiredTokens
int cleanUpExpiredTokens(IEntityContext ec)
Deletes all expired temporary MFA tokens from the database.- Parameters:
ec- the entity context- Returns:
- the number of tokens that were deleted
-
createNewToken
UserMfaTempToken createNewToken(IEntityContext ec, IUser user) throws UserMfaTempTokenMaxException
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
boolean deleteToken(IEntityContext ec, String tokenValue)
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
Optional<UserMfaTempToken> getToken(IEntityContext ec, String tokenValue)
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
boolean hasReachedMaxTokenLimit(IEntityContext ec, IUser user)
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
UserMfaTempToken refreshToken(IEntityContext ec, String token) throws UserMfaTempTokenNotFoundException, UserMfaTempTokenMaxException, UserMfaTempTokenExpiredException
-
deleteAllTokens
void deleteAllTokens(IEntityContext ec)
-
-