Record Class CompromisedPasswordPolicy

java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.credential.compromised.CompromisedPasswordPolicy

public record CompromisedPasswordPolicy(boolean checkOnSetOrChange, boolean checkOnLogin, CheckFailurePolicy onFailure) extends Record
Operator-controlled policy that governs when the compromised password check runs and how a failed check is interpreted.

Defaults:

  • checkOnSetOrChange = true — NIST SP 800-63B §5.1.1
  • checkOnLogin = false — checking on every login would leak timing information and rate-limit budget (CWE-203 / CWE-307)
  • onFailure = CheckFailurePolicy.ALLOW for online checkers; deployments that prefer fail-closed should set this to CheckFailurePolicy.BLOCK explicitly.
  • Constructor Details

    • CompromisedPasswordPolicy

      public CompromisedPasswordPolicy(boolean checkOnSetOrChange, boolean checkOnLogin, CheckFailurePolicy onFailure)
      Creates an instance of a CompromisedPasswordPolicy record class.
      Parameters:
      checkOnSetOrChange - the value for the checkOnSetOrChange record component
      checkOnLogin - the value for the checkOnLogin record component
      onFailure - the value for the onFailure record component
  • Method Details

    • defaults

      public static CompromisedPasswordPolicy defaults()
      Defaults: check on set / change only, allow on check failure.
    • failClosed

      public static CompromisedPasswordPolicy failClosed()
      Fail-closed variant: any check failure rejects the change.
    • disabled

      public static CompromisedPasswordPolicy disabled()
      Disabled variant: no check is ever invoked. Callers can use this to short-circuit the compromised-password pipeline without removing the SPI binding.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components 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.
    • checkOnSetOrChange

      public boolean checkOnSetOrChange()
      Returns the value of the checkOnSetOrChange record component.
      Returns:
      the value of the checkOnSetOrChange record component
    • checkOnLogin

      public boolean checkOnLogin()
      Returns the value of the checkOnLogin record component.
      Returns:
      the value of the checkOnLogin record component
    • onFailure

      public CheckFailurePolicy onFailure()
      Returns the value of the onFailure record component.
      Returns:
      the value of the onFailure record component