Interface TotpCredentialRepository
public interface TotpCredentialRepository
Port that stores the TOTP credential of each user.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanadvanceLastUsedStep(UUID userId, long step) Records the step of an accepted code, in one atomic step that only succeeds when the step is newer than the stored one, so that two concurrent requests cannot both spend the same code.voidMarks the credential of a user as confirmed.voiddeleteByUser(UUID userId) Deletes the credential of a user.findByUser(UUID userId) Finds the credential of a user.voidsave(TotpCredential credential) Stores a credential, replacing any previous one of the same user.
-
Method Details
-
findByUser
Finds the credential of a user.- Parameters:
userId- identifier of the user.- Returns:
- the credential, or an empty optional when the user has none.
-
save
Stores a credential, replacing any previous one of the same user.- Parameters:
credential- the credential to store.
-
confirm
Marks the credential of a user as confirmed.- Parameters:
userId- identifier of the user.
-
advanceLastUsedStep
Records the step of an accepted code, in one atomic step that only succeeds when the step is newer than the stored one, so that two concurrent requests cannot both spend the same code.- Parameters:
userId- identifier of the user.step- step of the accepted code.- Returns:
truewhen the step was newer and has been recorded.
-
deleteByUser
Deletes the credential of a user.- Parameters:
userId- identifier of the user.
-