I just went through a lot of documentation, having a similar problem.
My solution used a ResponseStatusException. AccessException for Spring-security seems understandable.
.doOnError(
t -> AccessDeniedException.class.isAssignableFrom(t.getClass()),
t -> AUDIT.error("Error {} {}, tried to access {}", t.getMessage(), principal, exchange.getRequest().getURI()))
.onErrorMap(
SomeOtherException.class,
t -> { return new ResponseStatusException(HttpStatus.NOT_FOUND, "Collection not found");})
;
If it goes in the right direction for you, I can provide a slightly better sample.
source
share