org.springframework.security.web.server.authorization.ServerAccessDeniedHandler Java Examples
The following examples show how to use
org.springframework.security.web.server.authorization.ServerAccessDeniedHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ReactiveConfig.java From errors-spring-boot-starter with Apache License 2.0 | 6 votes |
@Bean public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http, ServerAccessDeniedHandler accessDeniedHandler, ServerAuthenticationEntryPoint authenticationEntryPoint) { return http .csrf() .accessDeniedHandler(accessDeniedHandler) .and() .exceptionHandling() .authenticationEntryPoint(authenticationEntryPoint) .accessDeniedHandler(accessDeniedHandler) .and() .authorizeExchange() .pathMatchers(GET, "/test/protected").authenticated() .pathMatchers(POST, "/test/protected").hasRole("ADMIN") .anyExchange().permitAll() .and().build(); }
Example #2
Source File: ReactiveSecurityErrorsAutoConfiguration.java From errors-spring-boot-starter with Apache License 2.0 | 2 votes |
/** * Responsible for catching all access denied exceptions and delegating them to typical web error handlers * to perform the actual exception handling procedures. * * @param errorWebExceptionHandler Spring Boot's default exception handler which in turn would delegate to our * typical error handlers. * @return The registered access denied handler. */ @Bean @ConditionalOnClass(name = "org.springframework.security.web.server.authorization.ServerAccessDeniedHandler") public ServerAccessDeniedHandler accessDeniedHandler(ErrorWebExceptionHandler errorWebExceptionHandler) { return errorWebExceptionHandler::handle; }