Class OneTimeTokenLoginConfigurer<H extends HttpSecurityBuilder<H>>
java.lang.Object
org.springframework.security.config.annotation.SecurityConfigurerAdapter<org.springframework.security.web.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<org.springframework.security.web.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(org.springframework.security.web.authentication.AuthenticationConverter authenticationConverter) Use thisAuthenticationConverterwhen converting incoming requests to anAuthentication.authenticationFailureHandler(org.springframework.security.web.authentication.AuthenticationFailureHandler authenticationFailureHandler) Specifies theAuthenticationFailureHandlerto use when authentication fails.authenticationProvider(org.springframework.security.authentication.AuthenticationProvider authenticationProvider) Specifies theAuthenticationProviderto use when authenticating the user.authenticationSuccessHandler(org.springframework.security.web.authentication.AuthenticationSuccessHandler authenticationSuccessHandler) Specifies theAuthenticationSuccessHandlerto be used.voidConfigure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.defaultSubmitPageUrl(String submitPageUrl) Sets the URL that the default submit page will be generated.org.springframework.context.ApplicationContextvoidInitialize theSecurityBuilder.loginProcessingUrl(String loginProcessingUrl) Specifies the URL to process the login request, defaults to/login/ott.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(org.springframework.security.web.authentication.ott.OneTimeTokenGenerationSuccessHandler oneTimeTokenGenerationSuccessHandler) Specifies strategy to be used to handle generated one-time tokens.tokenService(org.springframework.security.authentication.ott.OneTimeTokenService oneTimeTokenService) Configures theOneTimeTokenServiceused to generate and consumeOneTimeTokenMethods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
disable, getSecurityContextHolderStrategy, withObjectPostProcessor, withObjectPostProcessorMethods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, addObjectPostProcessor, and, getBuilder, postProcess, setBuilder
-
Constructor Details
-
OneTimeTokenLoginConfigurer
public OneTimeTokenLoginConfigurer(org.springframework.context.ApplicationContext context)
-
-
Method Details
-
init
Description copied from interface:SecurityConfigurerInitialize theSecurityBuilder. Here only shared state should be created and modified, but not properties on theSecurityBuilderused 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:
initin interfaceSecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>> - Overrides:
initin classSecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>>
-
configure
Description copied from interface:SecurityConfigurerConfigure theSecurityBuilderby setting the necessary properties on theSecurityBuilder.- Specified by:
configurein interfaceSecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>> - Overrides:
configurein classSecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,H extends HttpSecurityBuilder<H>>
-
authenticationProvider
public OneTimeTokenLoginConfigurer<H> authenticationProvider(org.springframework.security.authentication.AuthenticationProvider authenticationProvider) Specifies theAuthenticationProviderto use when authenticating the user.- Parameters:
authenticationProvider-
-
tokenGeneratingUrl
Specifies the URL that a One-Time Token generate request will be processed. Defaults to/ott/generate.- Parameters:
tokenGeneratingUrl-
-
tokenGenerationSuccessHandler
public OneTimeTokenLoginConfigurer<H> tokenGenerationSuccessHandler(org.springframework.security.web.authentication.ott.OneTimeTokenGenerationSuccessHandler oneTimeTokenGenerationSuccessHandler) Specifies strategy to be used to handle generated one-time tokens.- Parameters:
oneTimeTokenGenerationSuccessHandler-
-
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 theDefaultOneTimeTokenSubmitPageGeneratingFilterto 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-
-
tokenService
public OneTimeTokenLoginConfigurer<H> tokenService(org.springframework.security.authentication.ott.OneTimeTokenService oneTimeTokenService) Configures theOneTimeTokenServiceused to generate and consumeOneTimeToken- Parameters:
oneTimeTokenService-
-
authenticationConverter
public OneTimeTokenLoginConfigurer<H> authenticationConverter(org.springframework.security.web.authentication.AuthenticationConverter authenticationConverter) Use thisAuthenticationConverterwhen converting incoming requests to anAuthentication. By default, theOneTimeTokenAuthenticationConverteris used.- Parameters:
authenticationConverter- theAuthenticationConverterto use
-
authenticationFailureHandler
public OneTimeTokenLoginConfigurer<H> authenticationFailureHandler(org.springframework.security.web.authentication.AuthenticationFailureHandler authenticationFailureHandler) Specifies theAuthenticationFailureHandlerto use when authentication fails. The default is redirecting to "/login?error" usingSimpleUrlAuthenticationFailureHandler- Parameters:
authenticationFailureHandler- theAuthenticationFailureHandlerto use when authentication fails.
-
authenticationSuccessHandler
public OneTimeTokenLoginConfigurer<H> authenticationSuccessHandler(org.springframework.security.web.authentication.AuthenticationSuccessHandler authenticationSuccessHandler) Specifies theAuthenticationSuccessHandlerto be used. The default isSavedRequestAwareAuthenticationSuccessHandlerwith no additional properties set.- Parameters:
authenticationSuccessHandler- theAuthenticationSuccessHandler.
-
getContext
public org.springframework.context.ApplicationContext getContext()
-