Class OttFactors
java.lang.Object
com.irurueta.authserver.authorization.api.web.ott.OttFactors
Registers the one-time token methods as authentication factors. One authority cannot carry two strengths and the
registry refuses two factors with the same authority, so each use of each channel is a factor of its own: the
e-mail code or magic link as a sign-in (
FACTOR_OTT, Spring Security's own constant) and the SMS code as a
sign-in are FactorStrength.PRIMARY (they prove the possession of a mailbox or a phone, which is as strong as
a password and no more), and the same two as the second factor of a user who already signed in with a primary
factor are FactorStrength.SECOND. The amr values are those of RFC 8176: otp for the code or
the link sent by e-mail and sms for the code sent by SMS.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringRFC 8176amrvalue of a one-time password sent by e-mail.static final StringAuthority of the e-mail code or magic link as a sign-in.static final StringAuthority of the e-mail code or magic link as a second factor.static final StringRFC 8176amrvalue of a one-time password sent by SMS.static final StringAuthority of the SMS code as a sign-in.static final StringAuthority of the SMS code as a second factor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDeclares the e-mail code and magic link as a sign-in.Declares the e-mail code and magic link as a second factor.Declares the SMS code as a sign-in.Declares the SMS code as a second factor.static StringsecondFactorAuthority(OttChannel channel) Gets the authority a channel grants when it is the second factor.static StringsignInAuthority(OttChannel channel) Gets the authority a channel grants when it signs the user in.
-
Field Details
-
EMAIL_AMR_VALUE
RFC 8176amrvalue of a one-time password sent by e-mail.- See Also:
-
SMS_AMR_VALUE
RFC 8176amrvalue of a one-time password sent by SMS.- See Also:
-
EMAIL_AUTHORITY
Authority of the e-mail code or magic link as a sign-in.- See Also:
-
SMS_AUTHORITY
Authority of the SMS code as a sign-in.- See Also:
-
EMAIL_SECOND_FACTOR_AUTHORITY
Authority of the e-mail code or magic link as a second factor.- See Also:
-
SMS_SECOND_FACTOR_AUTHORITY
Authority of the SMS code as a second factor.- See Also:
-
-
Constructor Details
-
OttFactors
public OttFactors()
-
-
Method Details
-
ottEmailAuthenticationFactor
Declares the e-mail code and magic link as a sign-in.- Returns:
- the factor.
-
ottSmsAuthenticationFactor
Declares the SMS code as a sign-in.- Returns:
- the factor.
-
ottEmailSecondAuthenticationFactor
Declares the e-mail code and magic link as a second factor.- Returns:
- the factor.
-
ottSmsSecondAuthenticationFactor
Declares the SMS code as a second factor.- Returns:
- the factor.
-
signInAuthority
Gets the authority a channel grants when it signs the user in.- Parameters:
channel- the channel the token was delivered through.- Returns:
EMAIL_AUTHORITYorSMS_AUTHORITY.
-
secondFactorAuthority
Gets the authority a channel grants when it is the second factor.- Parameters:
channel- the channel the token was delivered through.- Returns:
EMAIL_SECOND_FACTOR_AUTHORITYorSMS_SECOND_FACTOR_AUTHORITY.
-