How to make authenticationEntryPoint throws custom exception?

I am using jwt filter and it throws exception if jwt is not valid. I added customAuthenticationEntryPoint as authenticationEntryPoint and catch exception on GlobalExceptionHandler.

But somehow, my authenticationEntryPoint hides real exception and exposes as AuthenticationException. I mean if jwtFilter throws jwt exception, global exception handler receives as AuthenticationException and it loses it’s context. This returns normal when I remove authenticationEntryPoint. I want to return custom response when JWT expired other than generic AuthenticationException. How can I do that?

class CustomAuthenticationEntryPoint : AuthenticationEntryPoint {

    private var resolver: HandlerExceptionResolver? = null

    override fun commence(
        request: HttpServletRequest,
        response: HttpServletResponse,
        exception: AuthenticationException
    ) {
        resolver?.resolveException(request, response, null, exception)

It will be a bit workaround but you can add exception message to request context and read in CustomAuthenticationEntryPoint. If message exist, throw again.