Package com.espacogeek.geek.services
Interface EmailVerificationService
- All Known Implementing Classes:
EmailVerificationServiceImpl
public interface EmailVerificationService
Service for managing email verification tokens
-
Method Summary
Modifier and TypeMethodDescriptioncreateToken(UserModel user, String tokenType, String newEmail, int expirationHours) Create a new verification token for a uservoidDelete expired tokens (cleanup task)voiddeleteUserTokensByType(UserModel user, String tokenType) Delete all tokens for a user of a specific typevoidMark a token as usedvalidateToken(String token, String tokenType) Validate and retrieve a token
-
Method Details
-
createToken
EmailVerificationTokenModel createToken(UserModel user, String tokenType, String newEmail, int expirationHours) Create a new verification token for a user- Parameters:
user- The usertokenType- The type of token (e.g., "ACCOUNT_VERIFICATION", "PASSWORD_RESET", "EMAIL_CHANGE")newEmail- The new email (for email change requests), null otherwiseexpirationHours- Token expiration time in hours- Returns:
- The created token model
-
validateToken
Validate and retrieve a token- Parameters:
token- The token stringtokenType- The expected token type- Returns:
- Optional containing the token if valid
-
markTokenAsUsed
Mark a token as used- Parameters:
token- The token to mark as used
-
deleteExpiredTokens
void deleteExpiredTokens()Delete expired tokens (cleanup task) -
deleteUserTokensByType
Delete all tokens for a user of a specific type- Parameters:
user- The usertokenType- The token type
-