Record Class AuthenticationFactor
java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.domain.mfa.AuthenticationFactor
- Record Components:
id- stable identifier of the factor, for exampletotp.amrValue- value of theamrclaim (RFC 8176) reported when the factor was used, for exampleotp.- authority granted to an authentication that used the factor, for exampleFACTOR_TOTP.strength- how much the factor proves on its own.multiFactor- whether the factor alone proves a multi-factor authentication, so a session holding only it reaches the multi-factor class (acr) and passes a step-up: for example a sign-in at a provider trusted for, and reporting, its own multi-factor authentication. Only aFactorStrength.PRIMARY_STRONGfactor can be one; a strong factor that proves a single thing (a passkey whose user verification is not required, a certificate) is not.
public record AuthenticationFactor(String id, String amrValue, String authority, FactorStrength strength, boolean multiFactor)
extends Record
A way of authenticating, as registered by a feature.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringThe field for theamrValuerecord component.private final StringThe field for theauthorityrecord component.private final StringThe field for theidrecord component.private final booleanThe field for themultiFactorrecord component.private final FactorStrengthThe field for thestrengthrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionAuthenticationFactor(String id, String amrValue, String authority, FactorStrength strength) Creates a factor that does not prove a multi-factor authentication alone, the usual case.AuthenticationFactor(String id, String amrValue, String authority, FactorStrength strength, boolean multiFactor) Validates the factor. -
Method Summary
Modifier and TypeMethodDescriptionamrValue()Returns the value of theamrValuerecord component.Returns the value of theauthorityrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.booleanReturns the value of themultiFactorrecord component.strength()Returns the value of thestrengthrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
id
The field for theidrecord component. -
amrValue
The field for theamrValuerecord component. -
authority
The field for theauthorityrecord component. -
strength
The field for thestrengthrecord component. -
multiFactor
private final boolean multiFactorThe field for themultiFactorrecord component.
-
-
Constructor Details
-
AuthenticationFactor
public AuthenticationFactor(String id, String amrValue, String authority, FactorStrength strength, boolean multiFactor) Validates the factor.- Throws:
IllegalArgumentException- if a text is blank, the strength is missing, or a factor that is notFactorStrength.PRIMARY_STRONGclaims to be multi-factor alone.
-
AuthenticationFactor
Creates a factor that does not prove a multi-factor authentication alone, the usual case.- Parameters:
id- stable identifier of the factor.amrValue- value of theamrclaim reported when the factor was used.authority- authority granted to an authentication that used the factor.strength- how much the factor proves on its own.- Throws:
IllegalArgumentException- if a text is blank or the strength is missing.
-
-
Method Details
-
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. -
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. -
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 '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
amrValue
Returns the value of theamrValuerecord component.- Returns:
- the value of the
amrValuerecord component
-
authority
Returns the value of theauthorityrecord component.- Returns:
- the value of the
authorityrecord component
-
strength
Returns the value of thestrengthrecord component.- Returns:
- the value of the
strengthrecord component
-
multiFactor
public boolean multiFactor()Returns the value of themultiFactorrecord component.- Returns:
- the value of the
multiFactorrecord component
-