@ConditionalOnWebApplication(type=REACTIVE) @ConditionalOnBean(value=org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler.class) @ConditionalOnClass(name="org.springframework.security.web.server.authorization.ServerAccessDeniedHandler") public class ReactiveSecurityErrorsAutoConfiguration extends Object
ServerAccessDeniedHandler and another
ServerAuthenticationEntryPoint when the Reactive Spring Security is detected. These two handlers
are just gonna eventually delegate the exception handling procedure to plain old
WebErrorHandlers.
@EnableWebFluxSecurity
public class WebFluxSecurityConfig {
// other configurations
@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http,
ServerAccessDeniedHandler accessDeniedHandler,
ServerAuthenticationEntryPoint authenticationEntryPoint) {
http
.csrf().accessDeniedHandler(accessDeniedHandler)
.and()
.exceptionHandling()
.accessDeniedHandler(accessDeniedHandler)
.authenticationEntryPoint(authenticationEntryPoint)
// other configurations
return http.build();
}
}
| Constructor and Description |
|---|
ReactiveSecurityErrorsAutoConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.security.web.server.authorization.ServerAccessDeniedHandler |
accessDeniedHandler(org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler errorWebExceptionHandler)
Responsible for catching all access denied exceptions and delegating them to typical web error handlers
to perform the actual exception handling procedures.
|
org.springframework.security.web.server.ServerAuthenticationEntryPoint |
authenticationEntryPoint(org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler errorWebExceptionHandler)
Responsible for catching all authentication exceptions and delegating them to typical web error handlers
to perform the actual exception handling procedures.
|
public ReactiveSecurityErrorsAutoConfiguration()
@Bean @ConditionalOnClass(name="org.springframework.security.web.server.authorization.ServerAccessDeniedHandler") public org.springframework.security.web.server.authorization.ServerAccessDeniedHandler accessDeniedHandler(org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler errorWebExceptionHandler)
errorWebExceptionHandler - Spring Boot's default exception handler which in turn would delegate to our
typical error handlers.@Bean @ConditionalOnClass(name="org.springframework.security.web.server.ServerAuthenticationEntryPoint") public org.springframework.security.web.server.ServerAuthenticationEntryPoint authenticationEntryPoint(org.springframework.boot.web.reactive.error.ErrorWebExceptionHandler errorWebExceptionHandler)
errorWebExceptionHandler - Spring Boot's default exception handler which in turn would delegate to our
typical error handlers.Copyright © 2019. All rights reserved.