Hamdam23/bookee

500 error is thrown when 401 should be in charge

Closed this issue · 2 comments

500 error status is returning when token is invalid/expired/not-given on endpionts.

image

Quick summery:

  • Handling AuthenticationException will handle invalid credentials(username/password).
  • Handling AccessDeniedException is used for method level security such as securing a method for specific roles or authorities.

Token belongs to the User on 'user' role who does not have access.
Look there should be 403 Access Denied!

image

The bug is fixed. But I suggest using only one method of handling security exceptions. Choose one: custom exceptions (via ExceptionHandler) or security handlers (AccessDeniedHandler & AuthenticationEntryPoint)