protected void handleJwtRequest ( HttpServletRequest request , HttpServletResponse response , ServletContext servletContext , JwtConfig jwtConfig , EndpointType endpointType ) throws IOException { if ( jwtConfig == null ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "No JwtConfig object provided" ) ; } return ; } switch ( endpointType ) { case jwk : processJWKRequest ( response , jwtConfig ) ; return ; case token : try { if ( ! isTransportSecure ( request ) ) { String url = request . getRequestURL ( ) . toString ( ) ; Tr . error ( tc , "SECURITY.JWT.ERROR.WRONG.HTTP.SCHEME" , new Object [ ] { url } ) ; response . sendError ( HttpServletResponse . SC_NOT_FOUND , Tr . formatMessage ( tc , "SECURITY.JWT.ERROR.WRONG.HTTP.SCHEME" , new Object [ ] { url } ) ) ; return ; } boolean result = request . authenticate ( response ) ; if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "request.authenticate result: " + result ) ; } // if false, then not authenticated, // a 401 w. auth challenge will be sent back and // the response will be committed. // Requester can then try again with creds on a new request. if ( result == false ) { return ; } } catch ( ServletException e ) { // ffdc return ; } processTokenRequest ( response , jwtConfig ) ; return ; default : break ; } }
Handle the request for the respective endpoint to which the request was directed .