Class ServerHttpSecurity.OneTimeTokenLoginSpec
java.lang.Object
org.springframework.security.config.web.server.ServerHttpSecurity.OneTimeTokenLoginSpec
- Enclosing class:
- ServerHttpSecurity
Configures One-Time Token Login Support
- Since:
- 6.4
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionauthenticationConverter
(ServerAuthenticationConverter authenticationConverter) Use thisServerAuthenticationConverter
when converting incoming requests to anAuthentication
.authenticationFailureHandler
(ServerAuthenticationFailureHandler authenticationFailureHandler) Specifies theServerAuthenticationFailureHandler
to use when authentication fails.authenticationManager
(ReactiveAuthenticationManager authenticationManager) SpecifiesReactiveAuthenticationManager
for one time tokens.authenticationSuccessHandler
(Consumer<List<ServerAuthenticationSuccessHandler>> handlersConsumer) Allows customizing the list ofServerAuthenticationSuccessHandler
.authenticationSuccessHandler
(ServerAuthenticationSuccessHandler authenticationSuccessHandler) Specifies theServerAuthenticationSuccessHandler
protected void
configure
(ServerHttpSecurity http) defaultSubmitPageUrl
(String submitPageUrl) Sets the URL that the default submit page will be generated.loginProcessingUrl
(String loginProcessingUrl) Specifies the URL to process the login request, defaults to/login/ott
.securityContextRepository
(ServerSecurityContextRepository securityContextRepository) TheServerSecurityContextRepository
used to save theAuthentication
.showDefaultSubmitPage
(boolean show) Configures whether the default one-time token submit page should be shown.tokenGeneratingUrl
(String tokenGeneratingUrl) Specifies the URL that a One-Time Token generate request will be processed.tokenGenerationSuccessHandler
(ServerOneTimeTokenGenerationSuccessHandler oneTimeTokenGenerationSuccessHandler) Specifies strategy to be used to handle generated one-time tokens.tokenService
(ReactiveOneTimeTokenService oneTimeTokenService) Configures theReactiveOneTimeTokenService
used to generate and consumeOneTimeToken
-
Constructor Details
-
OneTimeTokenLoginSpec
public OneTimeTokenLoginSpec()
-
-
Method Details
-
configure
-
authenticationSuccessHandler
public ServerHttpSecurity.OneTimeTokenLoginSpec authenticationSuccessHandler(Consumer<List<ServerAuthenticationSuccessHandler>> handlersConsumer) Allows customizing the list ofServerAuthenticationSuccessHandler
. The default list contains aRedirectServerAuthenticationSuccessHandler
that redirects to "/".- Parameters:
handlersConsumer
- the handlers consumer- Returns:
- the
ServerHttpSecurity.OneTimeTokenLoginSpec
to continue configuring
-
authenticationSuccessHandler
public ServerHttpSecurity.OneTimeTokenLoginSpec authenticationSuccessHandler(ServerAuthenticationSuccessHandler authenticationSuccessHandler) Specifies theServerAuthenticationSuccessHandler
- Parameters:
authenticationSuccessHandler
- theServerAuthenticationSuccessHandler
.
-
authenticationFailureHandler
public ServerHttpSecurity.OneTimeTokenLoginSpec authenticationFailureHandler(ServerAuthenticationFailureHandler authenticationFailureHandler) Specifies theServerAuthenticationFailureHandler
to use when authentication fails. The default is redirecting to "/login?error" usingRedirectServerAuthenticationFailureHandler
- Parameters:
authenticationFailureHandler
- theServerAuthenticationFailureHandler
to use when authentication fails.
-
authenticationManager
public ServerHttpSecurity.OneTimeTokenLoginSpec authenticationManager(ReactiveAuthenticationManager authenticationManager) SpecifiesReactiveAuthenticationManager
for one time tokens. Default implementation isOneTimeTokenReactiveAuthenticationManager
- Parameters:
authenticationManager
-
-
tokenService
public ServerHttpSecurity.OneTimeTokenLoginSpec tokenService(ReactiveOneTimeTokenService oneTimeTokenService) Configures theReactiveOneTimeTokenService
used to generate and consumeOneTimeToken
- Parameters:
oneTimeTokenService
-
-
authenticationConverter
public ServerHttpSecurity.OneTimeTokenLoginSpec authenticationConverter(ServerAuthenticationConverter authenticationConverter) Use thisServerAuthenticationConverter
when converting incoming requests to anAuthentication
. By default, theServerOneTimeTokenAuthenticationConverter
is used.- Parameters:
authenticationConverter
- theServerAuthenticationConverter
to use
-
loginProcessingUrl
Specifies the URL to process the login request, defaults to/login/ott
. Only POST requests are processed, for that reason make sure that you pass a valid CSRF token if CSRF protection is enabled.- Parameters:
loginProcessingUrl
-
-
showDefaultSubmitPage
Configures whether the default one-time token submit page should be shown. This will prevent theOneTimeTokenSubmitPageGeneratingWebFilter
to be configured.- Parameters:
show
-
-
defaultSubmitPageUrl
Sets the URL that the default submit page will be generated. Defaults to/login/ott
. If you don't want to generate the default submit page you should useshowDefaultSubmitPage(boolean)
. Note that this method always invokeshowDefaultSubmitPage(boolean)
passingtrue
.- Parameters:
submitPageUrl
-
-
tokenGenerationSuccessHandler
public ServerHttpSecurity.OneTimeTokenLoginSpec tokenGenerationSuccessHandler(ServerOneTimeTokenGenerationSuccessHandler oneTimeTokenGenerationSuccessHandler) Specifies strategy to be used to handle generated one-time tokens.- Parameters:
oneTimeTokenGenerationSuccessHandler
-
-
tokenGeneratingUrl
Specifies the URL that a One-Time Token generate request will be processed. Defaults to/ott/generate
.- Parameters:
tokenGeneratingUrl
-
-
securityContextRepository
public ServerHttpSecurity.OneTimeTokenLoginSpec securityContextRepository(ServerSecurityContextRepository securityContextRepository) TheServerSecurityContextRepository
used to save theAuthentication
. Defaults toWebSessionServerSecurityContextRepository
. For theSecurityContext
to be loaded on subsequent requests theReactorContextWebFilter
must be configured to be able to load the value (they are not implicitly linked).- Parameters:
securityContextRepository
- the repository to use- Returns:
- the
ServerHttpSecurity.OneTimeTokenLoginSpec
to continue configuring
-