Record Class PasswordContext
java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.credential.input.PasswordContext
- Record Components:
username- the account login; nevernullemailLocalPart- optional — used for the local-part checkemailDomain- optional — used for the domain checktenant-TenantId.DEFAULTfor single-tenantforbiddenTerms- case-insensitive substrings rejected by the validator; defensively copied
public record PasswordContext(String username, Optional<String> emailLocalPart, Optional<String> emailDomain, TenantId tenant, Set<String> forbiddenTerms)
extends Record
Adapter-neutral user / application context consumed by the
ContextAwarePasswordValidator.
The Konzept §14 mandates context-specific checks (CWE-521) but
deliberately stays away from outdated composition rules (no
"must contain a symbol" by default). Operators provide their own
forbidden-term list via forbiddenTerms() — typically the
application name, the brand and any well-known buzzwords.
Email addresses are split into local part and domain so the
validator can flag each independently. None of the fields appear
in toString() verbatim beyond what String.toString
already produces — the values are non-secret operational metadata,
not credentials.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theemailDomainrecord component.Returns the value of theemailLocalPartrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theforbiddenTermsrecord component.static PasswordContextConvenience: build a context from username plus the literal"local@domain"email string.final inthashCode()Returns a hash code value for this object.tenant()Returns the value of thetenantrecord component.final StringtoString()Returns a string representation of this record class.username()Returns the value of theusernamerecord component.
-
Constructor Details
-
PasswordContext
public PasswordContext(String username, Optional<String> emailLocalPart, Optional<String> emailDomain, TenantId tenant, Set<String> forbiddenTerms) Creates an instance of aPasswordContextrecord class.- Parameters:
username- the value for theusernamerecord componentemailLocalPart- the value for theemailLocalPartrecord componentemailDomain- the value for theemailDomainrecord componenttenant- the value for thetenantrecord componentforbiddenTerms- the value for theforbiddenTermsrecord component
-
-
Method Details
-
fromEmail
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
username
-
emailLocalPart
Returns the value of theemailLocalPartrecord component.- Returns:
- the value of the
emailLocalPartrecord component
-
emailDomain
Returns the value of theemailDomainrecord component.- Returns:
- the value of the
emailDomainrecord component
-
tenant
-
forbiddenTerms
Returns the value of theforbiddenTermsrecord component.- Returns:
- the value of the
forbiddenTermsrecord component
-