public interface PasscodeService<P extends PasswordToken,U extends User>
| Modifier and Type | Method and Description |
|---|---|
Optional<P> |
consume(U user,
String purpose,
String passcode)
Consume a passcode.
|
P |
createPasscode(U user,
String purpose)
Create a new token for a User with a specific purpose.
|
String |
generateSecureToken()
Generate a new random token String.
|
boolean |
invalidate(String passcodeId)
Invalidate an active passcode.
|
List<P> |
readTokensForUser(U user,
String purpose)
Return all of a user's tokens for a particular purpose.
|
boolean |
status(String passcodeId)
Get the status of a
PasswordToken. |
P createPasscode(U user, String purpose)
user - The User who will own the token.purpose - The purpose for this token.PasswordToken object with the new plaintext passcode on the token
field.Optional<P> consume(U user, String purpose, String passcode)
user - The User that owns the token.purpose - The purpose of the token. This will be validated against the purpose stored
with the token.passcode - The passcode String to consume.boolean status(String passcodeId)
PasswordToken.passcodeId - The id of the PasswordToken.boolean invalidate(String passcodeId)
passcodeId - The id of the PasswordToken.List<P> readTokensForUser(U user, String purpose)
user - The User that owns the tokens.purpose - The purpose of the tokens.PasswordToken.String generateSecureToken()
Copyright © 2021. All rights reserved.