Interface ResetTokenStore
- All Known Implementing Classes:
InMemoryResetTokenStore
public interface ResetTokenStore
Persistence-neutral storage of password-reset tokens.
The store never logs verifier values or digests (CWE-209). It
supports CAS transitions on the ResetTokenStatus field so
tokens are guaranteed to be single-use even under concurrent
consume attempts (CWE-362, CWE-640).
-
Method Summary
Modifier and TypeMethodDescriptionfindBySelector(String selector) Looks up a token by selector.markConsumedIfCurrent(String selector, ResetTokenStatus expectedStatus) Atomically marks the token CONSUMED if its current status still matchesexpectedStatus.markExpiredIfCurrent(String selector, ResetTokenStatus expectedStatus) Atomically marks the token EXPIRED if its current status still matchesexpectedStatus.voidsave(ResetTokenRecord record) Inserts a freshly issued token.
-
Method Details
-
save
Inserts a freshly issued token. Implementations may throw when a record with the same selector already exists; in practice the selector entropy makes that impossible to hit by accident. -
findBySelector
Looks up a token by selector. Verifier digests are never compared here; that is the reset service's job. -
markConsumedIfCurrent
Atomically marks the token CONSUMED if its current status still matchesexpectedStatus. -
markExpiredIfCurrent
Atomically marks the token EXPIRED if its current status still matchesexpectedStatus. Called lazily when verification notices the expiry, so audit timelines stay accurate.
-