Class PasswordChangeService

java.lang.Object
com.svenruppert.jsentinel.credential.change.PasswordChangeService

public final class PasswordChangeService extends Object
Atomic, policy-driven password change.

Flow

  1. Load the credential by username; missing → NotFound.
  2. Consult the lifecycle service; status that forbids change (LOCKED / COMPROMISED / DISABLED) → Blocked.
  3. Re-authenticate by verifying the supplied current password (CWE-620). Anything but VerifiedCurrentPasswordRejected.
  4. Validate the proposed new password through the input policy. A rejection here surfaces the structural reason.
  5. Hash the new password through PasswordHashingService.
  6. Compare-and-swap the encoded hash with the original envelope as witness. Stale → Conflict (CWE-362).
  7. If the credential was MUST_CHANGE, clear it to ACTIVE through 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.
  8. Return Succeeded(INVALIDATE_OTHER_SESSIONS).