Class OneTimeTokenLoginConfigurer<H extends HttpSecurityBuilder<H>>
java.lang.Object
org.springframework.security.config.annotation.SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<OneTimeTokenLoginConfigurer<H>,H>
org.springframework.security.config.annotation.web.configurers.ott.OneTimeTokenLoginConfigurer<H>
- All Implemented Interfaces:
SecurityConfigurer<DefaultSecurityFilterChain,
H>
public final class OneTimeTokenLoginConfigurer<H extends HttpSecurityBuilder<H>>
extends AbstractHttpConfigurer<OneTimeTokenLoginConfigurer<H>,H>
-
Constructor Summary
ConstructorsConstructorDescriptionOneTimeTokenLoginConfigurer
(org.springframework.context.ApplicationContext context) -
Method Summary
Modifier and TypeMethodDescriptionauthenticationConverter
(AuthenticationConverter authenticationConverter) Use thisAuthenticationConverter
when converting incoming requests to anAuthentication
.authenticationFailureHandler
(AuthenticationFailureHandler authenticationFailureHandler) Specifies theAuthenticationFailureHandler
to use when authentication fails.authenticationProvider
(AuthenticationProvider authenticationProvider) Specifies theAuthenticationProvider
to use when authenticating the user.authenticationSuccessHandler
(AuthenticationSuccessHandler authenticationSuccessHandler) Specifies theAuthenticationSuccessHandler
to be used.void
Configure theSecurityBuilder
by setting the necessary properties on theSecurityBuilder
.defaultSubmitPageUrl
(String submitPageUrl) Sets the URL that the default submit page will be generated.generatedOneTimeTokenHandler
(GeneratedOneTimeTokenHandler generatedOneTimeTokenHandler) Specifies strategy to be used to handle generated one-time tokens.generateTokenUrl
(String generateTokenUrl) Specifies the URL that a One-Time Token generate request will be processed.org.springframework.context.ApplicationContext
void
Initialize theSecurityBuilder
.loginProcessingUrl
(String loginProcessingUrl) Specifies the URL to process the login request, defaults to/login/ott
.oneTimeTokenService
(OneTimeTokenService oneTimeTokenService) Configures theOneTimeTokenService
used to generate and consumeOneTimeToken
showDefaultSubmitPage
(boolean show) Configures whether the default one-time token submit page should be shown.Methods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
disable, getSecurityContextHolderStrategy, withObjectPostProcessor
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, and, getBuilder, postProcess, setBuilder
-
Constructor Details
-
OneTimeTokenLoginConfigurer
public OneTimeTokenLoginConfigurer(org.springframework.context.ApplicationContext context)
-
-
Method Details
-
init
Description copied from interface:SecurityConfigurer
Initialize theSecurityBuilder
. Here only shared state should be created and modified, but not properties on theSecurityBuilder
used for building the object. This ensures that theSecurityConfigurer.configure(SecurityBuilder)
method uses the correct shared objects when building. Configurers should be applied here.- Specified by:
init
in interfaceSecurityConfigurer<DefaultSecurityFilterChain,
H extends HttpSecurityBuilder<H>> - Overrides:
init
in classSecurityConfigurerAdapter<DefaultSecurityFilterChain,
H extends HttpSecurityBuilder<H>>
-
configure
Description copied from interface:SecurityConfigurer
Configure theSecurityBuilder
by setting the necessary properties on theSecurityBuilder
.- Specified by:
configure
in interfaceSecurityConfigurer<DefaultSecurityFilterChain,
H extends HttpSecurityBuilder<H>> - Overrides:
configure
in classSecurityConfigurerAdapter<DefaultSecurityFilterChain,
H extends HttpSecurityBuilder<H>>
-
authenticationProvider
public OneTimeTokenLoginConfigurer<H> authenticationProvider(AuthenticationProvider authenticationProvider) Specifies theAuthenticationProvider
to use when authenticating the user.- Parameters:
authenticationProvider
-
-
generateTokenUrl
Specifies the URL that a One-Time Token generate request will be processed. Defaults to/ott/generate
.- Parameters:
generateTokenUrl
-
-
generatedOneTimeTokenHandler
public OneTimeTokenLoginConfigurer<H> generatedOneTimeTokenHandler(GeneratedOneTimeTokenHandler generatedOneTimeTokenHandler) Specifies strategy to be used to handle generated one-time tokens.- Parameters:
generatedOneTimeTokenHandler
-
-
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
-- See Also:
-
showDefaultSubmitPage
Configures whether the default one-time token submit page should be shown. This will prevent theDefaultOneTimeTokenSubmitPageGeneratingFilter
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
-
-
oneTimeTokenService
Configures theOneTimeTokenService
used to generate and consumeOneTimeToken
- Parameters:
oneTimeTokenService
-
-
authenticationConverter
public OneTimeTokenLoginConfigurer<H> authenticationConverter(AuthenticationConverter authenticationConverter) Use thisAuthenticationConverter
when converting incoming requests to anAuthentication
. By default, theOneTimeTokenAuthenticationConverter
is used.- Parameters:
authenticationConverter
- theAuthenticationConverter
to use
-
authenticationFailureHandler
public OneTimeTokenLoginConfigurer<H> authenticationFailureHandler(AuthenticationFailureHandler authenticationFailureHandler) Specifies theAuthenticationFailureHandler
to use when authentication fails. The default is redirecting to "/login?error" usingSimpleUrlAuthenticationFailureHandler
- Parameters:
authenticationFailureHandler
- theAuthenticationFailureHandler
to use when authentication fails.
-
authenticationSuccessHandler
public OneTimeTokenLoginConfigurer<H> authenticationSuccessHandler(AuthenticationSuccessHandler authenticationSuccessHandler) Specifies theAuthenticationSuccessHandler
to be used. The default isSavedRequestAwareAuthenticationSuccessHandler
with no additional properties set.- Parameters:
authenticationSuccessHandler
- theAuthenticationSuccessHandler
.
-
getContext
public org.springframework.context.ApplicationContext getContext()
-