class AuthExceptionHandler extends AbstractExceptionHandler {

    @Override
    public void handleException(HttpServletRequest request, HttpServletResponse response, RuntimeException ex) throws ServletException {
        if (ex instanceof InsufficientAuthenticationException) {
            handleAuthenticationRequired(request, response, ex);
        } else if (ex instanceof BadCredentialsException) {
            handleBadCredentials(request, response, ex);
        } else if (ex instanceof AuthenticationCredentialsNotFoundException) {
            handleAuthenticationCredentialsNotFound(request, response, ex);
        } else if (ex instanceof AuthMethodNotSupportedException) {
            handleAuthMethodNotSupported(request, response, ex);
        } else if (ex instanceof TokenNotValidException) {
            handleTokenNotValid(request, response, ex);
        } else if (ex instanceof TokenNotProvidedException) {
            handleTokenNotProvided(request, response, ex);
        } else if (ex instanceof TokenExpireException) {
            handleTokenExpire(request, response, ex);
        } else if (ex instanceof TokenFormatNotValidException) {
            handleTokenFormatException(request, response, ex);
        }
        else if (ex instanceof InvalidCertificateException) {
            handleInvalidCertificate(response, ex);
        } else if (ex instanceof AuthenticationException) {
            handleAuthenticationException(request, response, ex);
        }
        else {
            throw new ServletException(ex);
        }
    }

    @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") public  AuthExceptionHandler(MessageService messageService, ObjectMapper objectMapper);

}