Record Class MfaProperties
java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.application.mfa.MfaProperties
- Record Components:
maxFailedAttempts- consecutive failed second-factor attempts that lock the second factor (default 5).lockout- how long the second factor stays locked (default 15 minutes).trustedDeviceValidity- how long a device stays trusted (default 30 days).totpIssuer- issuer shown by the authenticator app (defaultIrurueta Auth Server).stepUpMaxAge- how recent the multi-factor sign-in of a bearer token must be to remove or reset a second factor through the API (default 5 minutes).
@ConfigurationProperties("authserver.mfa")
public record MfaProperties(int maxFailedAttempts, Duration lockout, Duration trustedDeviceValidity, String totpIssuer, Duration stepUpMaxAge)
extends Record
Multi-factor settings, bound once from
authserver.mfa.* and injected wherever one of them is needed (the use
cases of this module and the step-up guard of the API). A value left out takes its default; an invalid one stops the
application at startup.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DurationThe field for thelockoutrecord component.private final intThe field for themaxFailedAttemptsrecord component.private final DurationThe field for thestepUpMaxAgerecord component.private final StringThe field for thetotpIssuerrecord component.private final DurationThe field for thetrustedDeviceValidityrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionMfaProperties(int maxFailedAttempts, Duration lockout, Duration trustedDeviceValidity, String totpIssuer, Duration stepUpMaxAge) Validates the settings. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.lockout()Returns the value of thelockoutrecord component.intReturns the value of themaxFailedAttemptsrecord component.private static voidrequirePositive(Duration value, String key) Rejects a missing or non-positive duration.Returns the value of thestepUpMaxAgerecord component.final StringtoString()Returns a string representation of this record class.Returns the value of thetotpIssuerrecord component.Returns the value of thetrustedDeviceValidityrecord component.
-
Field Details
-
maxFailedAttempts
private final int maxFailedAttemptsThe field for themaxFailedAttemptsrecord component. -
lockout
The field for thelockoutrecord component. -
trustedDeviceValidity
The field for thetrustedDeviceValidityrecord component. -
totpIssuer
The field for thetotpIssuerrecord component. -
stepUpMaxAge
The field for thestepUpMaxAgerecord component.
-
-
Constructor Details
-
MfaProperties
public MfaProperties(@DefaultValue("5") int maxFailedAttempts, @DefaultValue("PT15M") Duration lockout, @DefaultValue("P30D") Duration trustedDeviceValidity, @DefaultValue("Irurueta Auth Server") String totpIssuer, @DefaultValue("PT5M") Duration stepUpMaxAge) Validates the settings.- Throws:
IllegalArgumentException- ifmaxFailedAttemptsis less than one, a duration is missing or not positive, or the issuer is blank.
-
-
Method Details
-
requirePositive
Rejects a missing or non-positive duration.- Parameters:
value- the duration.key- the key of the setting, belowauthserver.mfa.- Throws:
IllegalArgumentException- if the duration is missing, zero or negative.
-
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 '=='. -
maxFailedAttempts
public int maxFailedAttempts()Returns the value of themaxFailedAttemptsrecord component.- Returns:
- the value of the
maxFailedAttemptsrecord component
-
lockout
Returns the value of thelockoutrecord component.- Returns:
- the value of the
lockoutrecord component
-
trustedDeviceValidity
Returns the value of thetrustedDeviceValidityrecord component.- Returns:
- the value of the
trustedDeviceValidityrecord component
-
totpIssuer
Returns the value of thetotpIssuerrecord component.- Returns:
- the value of the
totpIssuerrecord component
-
stepUpMaxAge
Returns the value of thestepUpMaxAgerecord component.- Returns:
- the value of the
stepUpMaxAgerecord component
-