Class OttConfiguration

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

@Configuration(value="ottWebConfiguration", proxyBeanMethods=false) public class OttConfiguration extends Object
Wires the one-time token methods into the login/UI chain. The filters are built here and handed to the customizer, never declared as beans: Spring Boot would register every Filter bean in the servlet container, outside the security chain. The providers are held in OttProviders, not declared as AuthenticationProvider beans, for the reason given there. The bean is named apart from the application layer's configuration of the same name.
  • Constructor Details

    • OttConfiguration

      public OttConfiguration()
  • Method Details

    • primaryFactorSession

      @Bean public PrimaryFactorSession primaryFactorSession(AuthenticationFactorRegistry factorRegistry)
      Declares the rules about the session a second factor is presented in.
      Parameters:
      factorRegistry - tells the strength of each factor authority.
      Returns:
      the rules.
    • ottGenerateRequestResolver

      @Bean public OttGenerateRequestResolver ottGenerateRequestResolver(OttPolicy ottPolicy)
      Declares the resolver of the token request of POST /ott/generate.
      Parameters:
      ottPolicy - the rules of one-time tokens, which set the lifetime of each kind.
      Returns:
      the resolver.
    • ottGenerationSuccessHandler

      @Bean public OttGenerationSuccessHandler ottGenerationSuccessHandler(RequestOneTimeCodeUseCase requestOneTimeCodeUseCase, RequestMagicLinkUseCase requestMagicLinkUseCase, org.springframework.security.authentication.ott.OneTimeTokenService tokenService, OttLinkFactory linkFactory, OttSecondFactorChannels secondFactorChannels)
      Declares the handler that delivers a generated token.
      Parameters:
      requestOneTimeCodeUseCase - starts a numeric code.
      requestMagicLinkUseCase - requests the delivery of a magic link.
      tokenService - store of the magic link tokens.
      linkFactory - builds the magic link.
      secondFactorChannels - decides which channels may be the second factor of the signed-in user.
      Returns:
      the handler.
    • ottProviders

      @Bean public OttProviders ottProviders(org.springframework.security.authentication.ott.OneTimeTokenService tokenService, org.springframework.security.core.userdetails.UserDetailsService userDetailsService, VerifyOneTimeCodeUseCase verifyOneTimeCodeUseCase, FactorGrantor factorGrantor, PrimaryFactorSession primaryFactorSession, OttSecondFactorChannels secondFactorChannels)
      Declares the authentication providers of the one-time token methods. The accounts are loaded through the user service wrapped so a disabled, locked or expired one is refused.
      Parameters:
      tokenService - store of the magic link tokens.
      userDetailsService - loads the accounts.
      verifyOneTimeCodeUseCase - verifies a numeric code.
      factorGrantor - adds the factor authority to an authentication.
      primaryFactorSession - rules about the session a second factor is presented in.
      secondFactorChannels - decides which channels may be the second factor of the signed-in user.
      Returns:
      the providers.
    • ottChainCustomizer

      @Bean @Order(3) public LoginChainCustomizer ottChainCustomizer(OttRateLimiter rateLimiter, OttGenerateRequestResolver requestResolver, OttGenerationSuccessHandler successHandler, org.springframework.security.authentication.ott.OneTimeTokenService tokenService, OttProviders providers, PrimaryFactorSession primaryFactorSession)
      Installs the one-time token methods in the login/UI chain.
      Parameters:
      rateLimiter - limits the token requests and submissions.
      requestResolver - resolves the token Spring's filter generates.
      successHandler - delivers the generated token.
      tokenService - store of the magic link tokens.
      providers - the authentication providers.
      primaryFactorSession - rules about the session a second factor is presented in.
      Returns:
      the customizer.
    • phonePageChainCustomizer

      @Bean @Order(4) public LoginChainCustomizer phonePageChainCustomizer(MfaAuthorizationManager authorizationManager)
      Keeps the phone page and its form posts behind the multi-factor policy.
      Parameters:
      authorizationManager - applies the multi-factor policy.
      Returns:
      the customizer.