Record Class PasswordInputPolicy
java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.credential.input.PasswordInputPolicy
- Record Components:
minLengthChars- minimum number of Java characters (default 8); 0 means "no minimum"maxLengthChars- maximum number of Java characters (default 1024); guards against pathological inputsunicodeNormalisationEnabled- whether the normalizer runs at all (defaulttrue)normalisationForm- which Unicode form to use; only consulted when normalisation is enabledrejectControlCharacters- whetherCharacter.isISOControl(int)code points are rejected (defaultfalseso newline/tab inside a passphrase remain legal)
public record PasswordInputPolicy(int minLengthChars, int maxLengthChars, boolean unicodeNormalisationEnabled, Normalizer.Form normalisationForm, boolean rejectControlCharacters)
extends Record
Operator-configurable input hygiene rules for password material.
Length bounds keep callers safe against overlong-input abuse (CWE-400). The Unicode normalisation flag controls whether passwords are normalised to a canonical form before hashing — if enabled, the same normalisation runs on hash and verify so two representations of the same characters still match (CWE-176).
Pre-hashing of overlong inputs is intentionally absent: silent
pre-hashing without a real pepper service makes credentials shuckable
(see Konzept §11 and Prompt 011). The bcrypt provider therefore
rejects overlong inputs explicitly; the maxLengthChars guard
here serves the other algorithms too.
-
Constructor Summary
ConstructorsConstructorDescriptionPasswordInputPolicy(int minLengthChars, int maxLengthChars, boolean unicodeNormalisationEnabled, Normalizer.Form normalisationForm, boolean rejectControlCharacters) Creates an instance of aPasswordInputPolicyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic PasswordInputPolicydefaults()OWASP-2023 baseline: 8..1024 characters, NFC normalisation on, control characters allowed.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxLengthCharsrecord component.intReturns the value of theminLengthCharsrecord component.Returns the value of thenormalisationFormrecord component.booleanReturns the value of therejectControlCharactersrecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of theunicodeNormalisationEnabledrecord component.
-
Constructor Details
-
PasswordInputPolicy
public PasswordInputPolicy(int minLengthChars, int maxLengthChars, boolean unicodeNormalisationEnabled, Normalizer.Form normalisationForm, boolean rejectControlCharacters) Creates an instance of aPasswordInputPolicyrecord class.- Parameters:
minLengthChars- the value for theminLengthCharsrecord componentmaxLengthChars- the value for themaxLengthCharsrecord componentunicodeNormalisationEnabled- the value for theunicodeNormalisationEnabledrecord componentnormalisationForm- the value for thenormalisationFormrecord componentrejectControlCharacters- the value for therejectControlCharactersrecord component
-
-
Method Details
-
defaults
OWASP-2023 baseline: 8..1024 characters, NFC normalisation on, control characters allowed. -
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
minLengthChars
public int minLengthChars()Returns the value of theminLengthCharsrecord component.- Returns:
- the value of the
minLengthCharsrecord component
-
maxLengthChars
public int maxLengthChars()Returns the value of themaxLengthCharsrecord component.- Returns:
- the value of the
maxLengthCharsrecord component
-
unicodeNormalisationEnabled
public boolean unicodeNormalisationEnabled()Returns the value of theunicodeNormalisationEnabledrecord component.- Returns:
- the value of the
unicodeNormalisationEnabledrecord component
-
normalisationForm
Returns the value of thenormalisationFormrecord component.- Returns:
- the value of the
normalisationFormrecord component
-
rejectControlCharacters
public boolean rejectControlCharacters()Returns the value of therejectControlCharactersrecord component.- Returns:
- the value of the
rejectControlCharactersrecord component
-