private void processJWKRequest ( HttpServletResponse response , JwtConfig jwtConfig ) throws IOException { /* * if (!jwtConfig.isJwkEnabled()) { String errorMsg = * Tr.formatMessage(tc, "JWK_ENDPOINT_JWK_NOT_ENABLED", new Object[] { * jwtConfig.getId() }); Tr.error(tc, errorMsg); * response.sendError(HttpServletResponse.SC_BAD_REQUEST, errorMsg); * return; } */ String signatureAlg = jwtConfig . getSignatureAlgorithm ( ) ; if ( ! Constants . SIGNATURE_ALG_RS256 . equals ( signatureAlg ) ) { String errorMsg = Tr . formatMessage ( tc , "JWK_ENDPOINT_WRONG_ALGORITHM" , new Object [ ] { jwtConfig . getId ( ) , signatureAlg , Constants . SIGNATURE_ALG_RS256 } ) ; Tr . error ( tc , errorMsg ) ; response . sendError ( HttpServletResponse . SC_BAD_REQUEST , errorMsg ) ; return ; } String jwkString = jwtConfig . getJwkJsonString ( ) ; addNoCacheHeaders ( response ) ; response . setStatus ( 200 ) ; if ( jwkString == null ) { return ; } try { PrintWriter pw = response . getWriter ( ) ; response . setHeader ( WebConstants . HTTP_HEADER_CONTENT_TYPE , WebConstants . HTTP_CONTENT_TYPE_JSON ) ; pw . write ( jwkString ) ; pw . flush ( ) ; pw . close ( ) ; } catch ( IOException e ) { if ( tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught an exception attempting to get the response writer: " + e . getLocalizedMessage ( ) ) ; } } }
Obtains the JWK string that is active in the specified config and prints it in JSON format in the response . If a JWK is not found the response will be empty .