How I can process authentication exceptions and basic HTTP500-like exceptions separetely in Spring Boot 3
I’m building an API using Spring Boot 3.0.1 with Spring Security, I’ve built out the security filter chain and use custom exception handler in it to process exceptions in authentication (for example when I get request without correct JWT token). But this handler processing all others exceptions (such as invalid agruments in query) by default and in situation when I try to process invalid request I getting 401-unauthorised
exception from my handler by default instead of 500-internal server error
.
What should I do for make my custom handler in FilterChain process ONLY authentication exceptions?