Class PasswordChangeService
java.lang.Object
com.svenruppert.jsentinel.credential.change.PasswordChangeService
Atomic, policy-driven password change.
Flow
- Load the credential by username; missing →
NotFound. - Consult the lifecycle service; status that forbids change
(LOCKED / COMPROMISED / DISABLED) →
Blocked. - Re-authenticate by verifying the supplied current password
(CWE-620). Anything but
Verified→CurrentPasswordRejected. - Validate the proposed new password through the input policy. A rejection here surfaces the structural reason.
- Hash the new password through
PasswordHashingService. - Compare-and-swap the encoded hash with the original envelope as
witness. Stale →
Conflict(CWE-362). - If the credential was
MUST_CHANGE, clear it toACTIVEthrough the lifecycle service. Failure to clear does not roll back the hash update — the password is already new; the next login will trigger the same clear. - Return
Succeeded(INVALIDATE_OTHER_SESSIONS).
-
Constructor Summary
ConstructorsConstructorDescriptionPasswordChangeService(CredentialStore store, PasswordHashingService hashingService, PasswordInputValidator inputValidator, PasswordInputPolicy inputPolicy, CredentialLifecycleService lifecycleService, Clock clock) -
Method Summary
-
Constructor Details
-
PasswordChangeService
public PasswordChangeService(CredentialStore store, PasswordHashingService hashingService, PasswordInputValidator inputValidator, PasswordInputPolicy inputPolicy, CredentialLifecycleService lifecycleService, Clock clock)
-
-
Method Details
-
change
-