Class OttChainCustomizer

java.lang.Object
com.irurueta.authserver.authorization.api.web.ott.OttChainCustomizer
All Implemented Interfaces:
LoginChainCustomizer

public class OttChainCustomizer extends Object implements LoginChainCustomizer
Adds the one-time token methods to the login/UI chain through http.oneTimeTokenLogin(...): the request of a token (POST /ott/generate), the submission of a magic link token or a numeric code (POST /login/ott) and, as a second factor, the submission of a code (POST /login/second-factor/ott). The pages the user lands on (where the code is typed, where a magic link is confirmed) are open to everybody and the second-factor post to signed-in users only. The rate limits are applied before anything else of the one-time token flow. CSRF protection stays on: every form carries the token. Once the chain is configured, the second-factor filter gets the chain's session authentication strategy, the one the form login uses (a new session id and a new CSRF token on success). Spring's own default submit page is turned off: the pages are this server's own.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static final class 
    Hands the session authentication strategy of the chain to the second-factor filter.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.springframework.security.web.authentication.AuthenticationConverter
    Reads what is posted to the sign-in endpoint.
    private final org.springframework.security.authentication.AuthenticationProvider
    Signs a user in with a numeric code.
    private final org.springframework.security.web.authentication.AuthenticationFailureHandler
    Sends the browser back after a failed sign-in.
    private final org.springframework.security.web.authentication.ott.OneTimeTokenGenerationSuccessHandler
    Delivers the token that was generated.
    private final org.springframework.security.authentication.AuthenticationProvider
    Confirms a magic link.
    static final int
    Order of this customizer in the login chain, after the TOTP (1) and passkey (2) ones.
    private final OttRateLimitFilter
    Applies the rate limits to the endpoints.
    private final org.springframework.security.web.authentication.ott.GenerateOneTimeTokenRequestResolver
    Resolves the token Spring's filter generates.
    private final OttSecondFactorFilter
    Processes the post of the second-factor code form.
    private final org.springframework.security.web.authentication.AuthenticationSuccessHandler
    Resumes the interrupted request after a sign-in.
    private final org.springframework.security.authentication.ott.OneTimeTokenService
    Store of the magic link tokens.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    customize(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
    Customizes the login/UI chain.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ORDER

      public static final int ORDER
      Order of this customizer in the login chain, after the TOTP (1) and passkey (2) ones.
      See Also:
    • rateLimitFilter

      private final OttRateLimitFilter rateLimitFilter
      Applies the rate limits to the endpoints.
    • requestResolver

      private final org.springframework.security.web.authentication.ott.GenerateOneTimeTokenRequestResolver requestResolver
      Resolves the token Spring's filter generates.
    • generationSuccessHandler

      private final org.springframework.security.web.authentication.ott.OneTimeTokenGenerationSuccessHandler generationSuccessHandler
      Delivers the token that was generated.
    • tokenService

      private final org.springframework.security.authentication.ott.OneTimeTokenService tokenService
      Store of the magic link tokens.
    • authenticationConverter

      private final org.springframework.security.web.authentication.AuthenticationConverter authenticationConverter
      Reads what is posted to the sign-in endpoint.
    • linkProvider

      private final org.springframework.security.authentication.AuthenticationProvider linkProvider
      Confirms a magic link.
    • codeProvider

      private final org.springframework.security.authentication.AuthenticationProvider codeProvider
      Signs a user in with a numeric code.
    • successHandler

      private final org.springframework.security.web.authentication.AuthenticationSuccessHandler successHandler
      Resumes the interrupted request after a sign-in.
    • failureHandler

      private final org.springframework.security.web.authentication.AuthenticationFailureHandler failureHandler
      Sends the browser back after a failed sign-in.
    • secondFactorFilter

      private final OttSecondFactorFilter secondFactorFilter
      Processes the post of the second-factor code form.
  • Constructor Details

    • OttChainCustomizer

      public OttChainCustomizer()
  • Method Details

    • customize

      public void customize(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
      Customizes the login/UI chain.
      Specified by:
      customize in interface LoginChainCustomizer
      Parameters:
      http - security builder of the chain.