<Spring WebFlux Security Custom AccessDeniedHandle...
# stackoverflow
u
Spring WebFlux Security Custom AccessDeniedHandler I have a REST endpoint where access is restricted to ADMIN users only: @GetMapping @PreAuthorize("hasAuthority('ADMIN')") fun getAll(): Flux { return Flux.fromIterable(userRepository.findAll()) } When I try to access this endpoint with a non-ADMIN user, I get a 403 with a denied response (a non JSON response). How can I customize the response to still receive a 403 response, but with a JSON message something like { "error": "Access denied" } The SecurityWebFilterChain I'm...