Package dev.getelements.elements.sdk.dao
Interface PasswordResetTokenDao
- All Known Implementing Classes:
MongoPasswordResetTokenDao
public interface PasswordResetTokenDao
DAO for single-use password reset tokens.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioncreateToken(User user, Timestamp expiry) Creates and persists a new password reset token for the given user.voiddeleteToken(String token) Deletes a token.voiddeleteTokensByUser(User user) Deletes all tokens belonging to the given user.Returns the token data if present and not expired.
-
Field Details
-
PASSWORD_RESET_TOKEN_CREATED
- See Also:
-
PASSWORD_RESET_TOKEN_DELETED
- See Also:
-
PASSWORD_RESET_TOKENS_TRUNCATED
- See Also:
-
-
Method Details
-
createToken
Creates and persists a new password reset token for the given user.- Parameters:
user- the user requesting the password resetexpiry- the expiry timestamp after which the token is invalid- Returns:
- the opaque token string (also the database primary key)
-
findToken
Returns the token data if present and not expired.- Parameters:
token- the opaque token string- Returns:
- an
Optionalcontaining the token, or empty if absent or expired
-
deleteToken
Deletes a token. Call after successful password reset to enforce single-use semantics.- Parameters:
token- the opaque token string to delete
-
deleteTokensByUser
Deletes all tokens belonging to the given user. Call on user deletion.- Parameters:
user- the user whose tokens should be removed
-