Interface EmailVerificationWhitelist
public interface EmailVerificationWhitelist
Simple whitelisting interface to enforce one-time use for email verification codes. Expectation is that
prior to sending an email with a verification code,
add(context, token) is called to add the
token to a whitelist. When the token is consumed (through clicking a link in an email),
validateAndRemove(context, token) is called to a) validate that the token is still valid (has
not been used) and b) removes the token from the whitelist, thereby ensuring one-time use.
Implementations may also implement their own expiry mechanisms as needed, but this not enforced via this interface.
-
Method Summary
-
Method Details
-
add
Add the token to the whitelist.- Parameters:
context- the request context of the process adding the tokentoken- the token to whitelist
-
validateAndRemove
Check to see if the token is valid (still in whitelist) and remove it.- Parameters:
context- the request context of the process validating the tokentoken- the token to validate- Returns:
- whether the token is valid
-