Class OttSecondFactorFragment

java.lang.Object
com.irurueta.authserver.authorization.api.web.ott.OttSecondFactorFragment
All Implemented Interfaces:
SecondFactorFragment

@Component public class OttSecondFactorFragment extends Object implements SecondFactorFragment
Contributes the one-time token second factor to the second-factor page: the buttons that send a code or a magic link by e-mail and a code by SMS to the signed-in user, each posting to POST /ott/generate with the second-factor purpose. Only the channels OttSecondFactorChannels allows are offered: never the one that signed the user in, SMS only to a user with a verified phone, and e-mail only to a user without any other confirmed second factor.
  • Field Details

    • ORDER

      public static final int ORDER
      Position of the one-time token action in the second-factor page: after the passkey one.
      See Also:
    • EMAIL_AVAILABLE_ATTRIBUTE

      public static final String EMAIL_AVAILABLE_ATTRIBUTE
      Model attribute telling the fragment whether to offer the e-mail code and link.
      See Also:
    • SMS_AVAILABLE_ATTRIBUTE

      public static final String SMS_AVAILABLE_ATTRIBUTE
      Model attribute telling the fragment whether to offer the SMS code.
      See Also:
    • secondFactorChannels

      private final OttSecondFactorChannels secondFactorChannels
      Decides which channels may be the second factor of the user.
  • Constructor Details

    • OttSecondFactorFragment

      public OttSecondFactorFragment()
  • Method Details

    • templateName

      public String templateName()
      Gets the template that holds the fragment.
      Specified by:
      templateName in interface SecondFactorFragment
      Returns:
      ott-second-factor.
    • fragmentName

      public String fragmentName()
      Gets the fragment of the template.
      Specified by:
      fragmentName in interface SecondFactorFragment
      Returns:
      form.
    • order

      public int order()
      Gets the position of the fragment.
      Specified by:
      order in interface SecondFactorFragment
      Returns:
      ORDER.
    • modelAttributes

      public Map<String,Object> modelAttributes(org.springframework.security.core.Authentication authentication)
      Tells the template which channels to offer.
      Specified by:
      modelAttributes in interface SecondFactorFragment
      Parameters:
      authentication - the authentication of the user the page is rendered for.
      Returns:
      the model attributes; none when nobody is signed in.