Package org.springframework.security.config.web.server

# Class ServerHttpSecurity.OneTimeTokenLoginSpec

java.lang.Object
org.springframework.security.config.web.server.ServerHttpSecurity.OneTimeTokenLoginSpec

Enclosing class:
  ServerHttpSecurity

public final class ServerHttpSecurity.OneTimeTokenLoginSpec extends Object
Configures One-Time Token Login Support

Since:
  6.4
See Also:
  - `ServerHttpSecurity.oneTimeTokenLogin(Customizer)`

## Constructor Summary

Constructors
Constructor
Description
`OneTimeTokenLoginSpec()`

## Method Summary

Modifier and Type
Method
Description
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`authenticationConverter(org.springframework.security.web.server.authentication.ServerAuthenticationConverter authenticationConverter)`
Use this `ServerAuthenticationConverter` when converting incoming requests to an `Authentication`.
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`authenticationFailureHandler(org.springframework.security.web.server.authentication.ServerAuthenticationFailureHandler authenticationFailureHandler)`
Specifies the `ServerAuthenticationFailureHandler` to use when authentication fails.
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`authenticationManager(org.springframework.security.authentication.ReactiveAuthenticationManager authenticationManager)`
Specifies `ReactiveAuthenticationManager` for one time tokens.
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`authenticationSuccessHandler(Consumer<List<org.springframework.security.web.server.authentication.ServerAuthenticationSuccessHandler>> handlersConsumer)`
Allows customizing the list of `ServerAuthenticationSuccessHandler`.
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`authenticationSuccessHandler(org.springframework.security.web.server.authentication.ServerAuthenticationSuccessHandler authenticationSuccessHandler)`
Specifies the `ServerAuthenticationSuccessHandler`
`protected void`
`configure(ServerHttpSecurity http)`
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`defaultSubmitPageUrl(String submitPageUrl)`
Sets the URL that the default submit page will be generated.
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`loginProcessingUrl(String loginProcessingUrl)`
Specifies the URL to process the login request, defaults to `/login/ott`.
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`securityContextRepository(org.springframework.security.web.server.context.ServerSecurityContextRepository securityContextRepository)`
The `ServerSecurityContextRepository` used to save the `Authentication`.
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`showDefaultSubmitPage(boolean show)`
Configures whether the default one-time token submit page should be shown.
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`tokenGeneratingUrl(String tokenGeneratingUrl)`
Specifies the URL that a One-Time Token generate request will be processed.
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`tokenGenerationSuccessHandler(org.springframework.security.web.server.authentication.ott.ServerOneTimeTokenGenerationSuccessHandler oneTimeTokenGenerationSuccessHandler)`
Specifies strategy to be used to handle generated one-time tokens.
`ServerHttpSecurity.OneTimeTokenLoginSpec`
`tokenService(org.springframework.security.authentication.ott.reactive.ReactiveOneTimeTokenService oneTimeTokenService)`
Configures the `ReactiveOneTimeTokenService` used to generate and consume `OneTimeToken`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### OneTimeTokenLoginSpec

public OneTimeTokenLoginSpec()

## Method Details

### configure

protected void configure(ServerHttpSecurity http)

### authenticationSuccessHandler

public ServerHttpSecurity.OneTimeTokenLoginSpec authenticationSuccessHandler(Consumer<List<org.springframework.security.web.server.authentication.ServerAuthenticationSuccessHandler>> handlersConsumer)
Allows customizing the list of `ServerAuthenticationSuccessHandler`. The default list contains a `RedirectServerAuthenticationSuccessHandler` that redirects to "/".

Parameters:
  `handlersConsumer` - the handlers consumer
Returns:
  the `ServerHttpSecurity.OneTimeTokenLoginSpec` to continue configuring

### authenticationSuccessHandler

public ServerHttpSecurity.OneTimeTokenLoginSpec authenticationSuccessHandler(org.springframework.security.web.server.authentication.ServerAuthenticationSuccessHandler authenticationSuccessHandler)
Specifies the `ServerAuthenticationSuccessHandler`

Parameters:
  `authenticationSuccessHandler` - the `ServerAuthenticationSuccessHandler`.

### authenticationFailureHandler

public ServerHttpSecurity.OneTimeTokenLoginSpec authenticationFailureHandler(org.springframework.security.web.server.authentication.ServerAuthenticationFailureHandler authenticationFailureHandler)
Specifies the `ServerAuthenticationFailureHandler` to use when authentication fails. The default is redirecting to "/login?error" using `RedirectServerAuthenticationFailureHandler`

Parameters:
  `authenticationFailureHandler` - the `ServerAuthenticationFailureHandler` to use when authentication fails.

### authenticationManager

public ServerHttpSecurity.OneTimeTokenLoginSpec authenticationManager(org.springframework.security.authentication.ReactiveAuthenticationManager authenticationManager)
Specifies `ReactiveAuthenticationManager` for one time tokens. Default implementation is `OneTimeTokenReactiveAuthenticationManager`

Parameters:
  `authenticationManager` -

### tokenService

public ServerHttpSecurity.OneTimeTokenLoginSpec tokenService(org.springframework.security.authentication.ott.reactive.ReactiveOneTimeTokenService oneTimeTokenService)
Configures the `ReactiveOneTimeTokenService` used to generate and consume `OneTimeToken`

Parameters:
  `oneTimeTokenService` -

### authenticationConverter

public ServerHttpSecurity.OneTimeTokenLoginSpec authenticationConverter(org.springframework.security.web.server.authentication.ServerAuthenticationConverter authenticationConverter)
Use this `ServerAuthenticationConverter` when converting incoming requests to an `Authentication`. By default, the `ServerOneTimeTokenAuthenticationConverter` is used.

Parameters:
  `authenticationConverter` - the `ServerAuthenticationConverter` to use

### loginProcessingUrl

public ServerHttpSecurity.OneTimeTokenLoginSpec loginProcessingUrl(String 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

public ServerHttpSecurity.OneTimeTokenLoginSpec showDefaultSubmitPage(boolean show)
Configures whether the default one-time token submit page should be shown. This will prevent the `OneTimeTokenSubmitPageGeneratingWebFilter` to be configured.

Parameters:
  `show` -

### defaultSubmitPageUrl

public ServerHttpSecurity.OneTimeTokenLoginSpec defaultSubmitPageUrl(String submitPageUrl)
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 use `showDefaultSubmitPage(boolean)`. Note that this method always invoke `showDefaultSubmitPage(boolean)` passing `true`.

Parameters:
  `submitPageUrl` -

### tokenGenerationSuccessHandler

public ServerHttpSecurity.OneTimeTokenLoginSpec tokenGenerationSuccessHandler(org.springframework.security.web.server.authentication.ott.ServerOneTimeTokenGenerationSuccessHandler oneTimeTokenGenerationSuccessHandler)
Specifies strategy to be used to handle generated one-time tokens.

Parameters:
  `oneTimeTokenGenerationSuccessHandler` -

### tokenGeneratingUrl

public ServerHttpSecurity.OneTimeTokenLoginSpec tokenGeneratingUrl(String 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(org.springframework.security.web.server.context.ServerSecurityContextRepository securityContextRepository)
The `ServerSecurityContextRepository` used to save the `Authentication`. Defaults to `WebSessionServerSecurityContextRepository`. For the `SecurityContext` to be loaded on subsequent requests the `ReactorContextWebFilter` 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