java.lang.Object
com.irurueta.authserver.authorization.api.web.ott.OttFactors

@Configuration(proxyBeanMethods=false) public class OttFactors extends Object
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 Details

    • EMAIL_AMR_VALUE

      public static final String EMAIL_AMR_VALUE
      RFC 8176 amr value of a one-time password sent by e-mail.
      See Also:
    • SMS_AMR_VALUE

      public static final String SMS_AMR_VALUE
      RFC 8176 amr value of a one-time password sent by SMS.
      See Also:
    • EMAIL_AUTHORITY

      public static final String EMAIL_AUTHORITY
      Authority of the e-mail code or magic link as a sign-in.
      See Also:
    • SMS_AUTHORITY

      public static final String SMS_AUTHORITY
      Authority of the SMS code as a sign-in.
      See Also:
    • EMAIL_SECOND_FACTOR_AUTHORITY

      public static final String EMAIL_SECOND_FACTOR_AUTHORITY
      Authority of the e-mail code or magic link as a second factor.
      See Also:
    • SMS_SECOND_FACTOR_AUTHORITY

      public static final String SMS_SECOND_FACTOR_AUTHORITY
      Authority of the SMS code as a second factor.
      See Also:
  • Constructor Details

    • OttFactors

      public OttFactors()
  • Method Details

    • ottEmailAuthenticationFactor

      @Bean public AuthenticationFactor ottEmailAuthenticationFactor()
      Declares the e-mail code and magic link as a sign-in.
      Returns:
      the factor.
    • ottSmsAuthenticationFactor

      @Bean public AuthenticationFactor ottSmsAuthenticationFactor()
      Declares the SMS code as a sign-in.
      Returns:
      the factor.
    • ottEmailSecondAuthenticationFactor

      @Bean public AuthenticationFactor ottEmailSecondAuthenticationFactor()
      Declares the e-mail code and magic link as a second factor.
      Returns:
      the factor.
    • ottSmsSecondAuthenticationFactor

      @Bean public AuthenticationFactor ottSmsSecondAuthenticationFactor()
      Declares the SMS code as a second factor.
      Returns:
      the factor.
    • signInAuthority

      public static String signInAuthority(OttChannel channel)
      Gets the authority a channel grants when it signs the user in.
      Parameters:
      channel - the channel the token was delivered through.
      Returns:
      EMAIL_AUTHORITY or SMS_AUTHORITY.
    • secondFactorAuthority

      public static String secondFactorAuthority(OttChannel channel)
      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_AUTHORITY or SMS_SECOND_FACTOR_AUTHORITY.