Class InMemoryResetTokenStore
java.lang.Object
com.svenruppert.jsentinel.credential.reset.InMemoryResetTokenStore
- All Implemented Interfaces:
ResetTokenStore
-
Constructor Summary
Constructors -
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.intsize()Test helper: number of stored tokens.
-
Constructor Details
-
InMemoryResetTokenStore
public InMemoryResetTokenStore()
-
-
Method Details
-
save
Description copied from interface:ResetTokenStoreInserts 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.- Specified by:
savein interfaceResetTokenStore
-
findBySelector
Description copied from interface:ResetTokenStoreLooks up a token by selector. Verifier digests are never compared here; that is the reset service's job.- Specified by:
findBySelectorin interfaceResetTokenStore
-
markConsumedIfCurrent
public ResetTokenUpdateResult markConsumedIfCurrent(String selector, ResetTokenStatus expectedStatus) Description copied from interface:ResetTokenStoreAtomically marks the token CONSUMED if its current status still matchesexpectedStatus.- Specified by:
markConsumedIfCurrentin interfaceResetTokenStore
-
markExpiredIfCurrent
public ResetTokenUpdateResult markExpiredIfCurrent(String selector, ResetTokenStatus expectedStatus) Description copied from interface:ResetTokenStoreAtomically marks the token EXPIRED if its current status still matchesexpectedStatus. Called lazily when verification notices the expiry, so audit timelines stay accurate.- Specified by:
markExpiredIfCurrentin interfaceResetTokenStore
-
size
public int size()Test helper: number of stored tokens.
-