Class ServerHttpSecurity.FormLoginSpec
- java.lang.Object
-
- org.springframework.security.config.web.server.ServerHttpSecurity.FormLoginSpec
-
- Enclosing class:
- ServerHttpSecurity
public final class ServerHttpSecurity.FormLoginSpec extends java.lang.ObjectConfigures Form Based authentication- Since:
- 5.0
- See Also:
ServerHttpSecurity.formLogin()
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerHttpSecurityand()Allows method chaining to continue configuring theServerHttpSecurityServerHttpSecurity.FormLoginSpecauthenticationEntryPoint(org.springframework.security.web.server.ServerAuthenticationEntryPoint authenticationEntryPoint)How to request for authentication.ServerHttpSecurity.FormLoginSpecauthenticationFailureHandler(org.springframework.security.web.server.authentication.ServerAuthenticationFailureHandler authenticationFailureHandler)Configures how a failed authentication is handled.ServerHttpSecurity.FormLoginSpecauthenticationManager(org.springframework.security.authentication.ReactiveAuthenticationManager authenticationManager)TheReactiveAuthenticationManagerused to authenticate.ServerHttpSecurity.FormLoginSpecauthenticationSuccessHandler(org.springframework.security.web.server.authentication.ServerAuthenticationSuccessHandler authenticationSuccessHandler)TheServerAuthenticationSuccessHandlerused after authentication success.protected voidconfigure(ServerHttpSecurity http)ServerHttpSecuritydisable()Disables HTTP Basic authentication.ServerHttpSecurity.FormLoginSpecloginPage(java.lang.String loginPage)Configures the log in page to redirect to, the authentication failure page, and when authentication is performed.ServerHttpSecurity.FormLoginSpecrequiresAuthenticationMatcher(org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher requiresAuthenticationMatcher)Configures when authentication is performed.ServerHttpSecurity.FormLoginSpecsecurityContextRepository(org.springframework.security.web.server.context.ServerSecurityContextRepository securityContextRepository)TheServerSecurityContextRepositoryused to save theAuthentication.
-
-
-
Method Detail
-
authenticationManager
public ServerHttpSecurity.FormLoginSpec authenticationManager(org.springframework.security.authentication.ReactiveAuthenticationManager authenticationManager)
TheReactiveAuthenticationManagerused to authenticate. Defaults toServerHttpSecurity.authenticationManager(ReactiveAuthenticationManager).- Parameters:
authenticationManager- the authentication manager to use- Returns:
- the
ServerHttpSecurity.FormLoginSpecto continue configuring
-
authenticationSuccessHandler
public ServerHttpSecurity.FormLoginSpec authenticationSuccessHandler(org.springframework.security.web.server.authentication.ServerAuthenticationSuccessHandler authenticationSuccessHandler)
TheServerAuthenticationSuccessHandlerused after authentication success. Defaults toRedirectServerAuthenticationSuccessHandler.- Parameters:
authenticationSuccessHandler- the success handler to use- Returns:
- the
ServerHttpSecurity.FormLoginSpecto continue configuring
-
loginPage
public ServerHttpSecurity.FormLoginSpec loginPage(java.lang.String loginPage)
Configures the log in page to redirect to, the authentication failure page, and when authentication is performed. The default is that Spring Security will generate a log in page at "/login" and a log out page at "/logout". If this is customized:- The default log in & log out page are no longer provided
- The application must render a log in page at the provided URL
- The application must render an authentication error page at the provided URL + "?error"
- Authentication will occur for POST to the provided URL
- Parameters:
loginPage- the url to redirect to which provides a form to log in (i.e. "/login")- Returns:
- the
ServerHttpSecurity.FormLoginSpecto continue configuring - See Also:
authenticationEntryPoint(ServerAuthenticationEntryPoint),requiresAuthenticationMatcher(ServerWebExchangeMatcher),authenticationFailureHandler(ServerAuthenticationFailureHandler)
-
authenticationEntryPoint
public ServerHttpSecurity.FormLoginSpec authenticationEntryPoint(org.springframework.security.web.server.ServerAuthenticationEntryPoint authenticationEntryPoint)
How to request for authentication. The default is that Spring Security will generate a log in page at "/login".- Parameters:
authenticationEntryPoint- the entry point to use- Returns:
- the
ServerHttpSecurity.FormLoginSpecto continue configuring - See Also:
loginPage(String)
-
requiresAuthenticationMatcher
public ServerHttpSecurity.FormLoginSpec requiresAuthenticationMatcher(org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher requiresAuthenticationMatcher)
Configures when authentication is performed. The default is a POST to "/login".- Parameters:
requiresAuthenticationMatcher- the matcher to use- Returns:
- the
ServerHttpSecurity.FormLoginSpecto continue configuring - See Also:
loginPage(String)
-
authenticationFailureHandler
public ServerHttpSecurity.FormLoginSpec authenticationFailureHandler(org.springframework.security.web.server.authentication.ServerAuthenticationFailureHandler authenticationFailureHandler)
Configures how a failed authentication is handled. The default is to redirect to "/login?error".- Parameters:
authenticationFailureHandler- the handler to use- Returns:
- the
ServerHttpSecurity.FormLoginSpecto continue configuring - See Also:
loginPage(String)
-
securityContextRepository
public ServerHttpSecurity.FormLoginSpec securityContextRepository(org.springframework.security.web.server.context.ServerSecurityContextRepository securityContextRepository)
TheServerSecurityContextRepositoryused to save theAuthentication. Defaults toWebSessionServerSecurityContextRepository. For theSecurityContextto be loaded on subsequent requests theReactorContextWebFiltermust be configured to be able to load the value (they are not implicitly linked).- Parameters:
securityContextRepository- the repository to use- Returns:
- the
ServerHttpSecurity.FormLoginSpecto continue configuring
-
and
public ServerHttpSecurity and()
Allows method chaining to continue configuring theServerHttpSecurity- Returns:
- the
ServerHttpSecurityto continue configuring
-
disable
public ServerHttpSecurity disable()
Disables HTTP Basic authentication.- Returns:
- the
ServerHttpSecurityto continue configuring
-
configure
protected void configure(ServerHttpSecurity http)
-
-