Record Class PasswordHistoryPolicy

java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.credential.history.PasswordHistoryPolicy
Record Components:
enabled - whether the history check runs at all
retainLast - how many historical verifiers to keep per user; only consulted when enabled is true

public record PasswordHistoryPolicy(boolean enabled, int retainLast) extends Record
Opt-in password-history policy.

Trade-off

Password history rejects reuse of the last N passwords, which can reduce easy rotation cycles. The trade-off is real, however: every stored verifier is an additional attack surface (CWE-522). The Konzept ยง15 explicitly recommends keeping password history off by default and never enabling it together with forced periodic rotation โ€” that combination drives users toward the weakest possible incremental passwords.

  • Constructor Details

    • PasswordHistoryPolicy

      public PasswordHistoryPolicy(boolean enabled, int retainLast)
      Creates an instance of a PasswordHistoryPolicy record class.
      Parameters:
      enabled - the value for the enabled record component
      retainLast - the value for the retainLast record component
  • Method Details

    • disabled

      public static PasswordHistoryPolicy disabled()
      History disabled โ€” the production default.
    • retain

      public static PasswordHistoryPolicy retain(int retainLast)
      History enabled with retainLast verifiers per user.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • enabled

      public boolean enabled()
      Returns the value of the enabled record component.
      Returns:
      the value of the enabled record component
    • retainLast

      public int retainLast()
      Returns the value of the retainLast record component.
      Returns:
      the value of the retainLast record component