Class PasswordHistoryService
java.lang.Object
com.svenruppert.jsentinel.credential.history.PasswordHistoryService
Coordinates the optional password-history check.
Adapters call evaluate(String, SecretValue, PasswordHistoryPolicy)
with the candidate password before persisting the new hash.
If the policy is disabled the service returns
PasswordHistoryDecision.Allowed without touching the
store. If enabled it verifies the candidate against each retained
verifier through the same PasswordHashingService used for
the normal login path — old envelopes therefore remain readable
as long as their algorithm is still registered (CWE-693).
After a successful change adapters call
recordNew(String, String, Instant, PasswordHistoryPolicy)
with the freshly produced envelope and the active retention
setting. The store enforces the cap via
PasswordHistoryStore.appendAndTrim(String, PasswordHistoryEntry, int) (CWE-400).
-
Constructor Summary
ConstructorsConstructorDescriptionPasswordHistoryService(PasswordHistoryStore store, PasswordHashingService hashingService) -
Method Summary
Modifier and TypeMethodDescriptionevaluate(String username, SecretValue candidate, PasswordHistoryPolicy policy) ReturnsPasswordHistoryDecision.Reusedwhen the supplied candidate verifies against any retained envelope underpolicy.voidrecordNew(String username, String encodedHash, Instant when, PasswordHistoryPolicy policy) Records the new envelope in the per-user history and trims to the retention size.
-
Constructor Details
-
PasswordHistoryService
-
-
Method Details
-
evaluate
public PasswordHistoryDecision evaluate(String username, SecretValue candidate, PasswordHistoryPolicy policy) ReturnsPasswordHistoryDecision.Reusedwhen the supplied candidate verifies against any retained envelope underpolicy. History disabled or retention size 0 → alwaysPasswordHistoryDecision.Allowed. -
recordNew
public void recordNew(String username, String encodedHash, Instant when, PasswordHistoryPolicy policy) Records the new envelope in the per-user history and trims to the retention size. No-op whenpolicy.enabled()is false.
-