protected String getUserInfoFromURL ( ConvergedClientConfig config , SSLSocketFactory sslsf , String accessToken ) { String url = config . getUserInfoEndpointUrl ( ) ; boolean hostnameVerification = config . isHostNameVerificationEnabled ( ) ; // https required by spec, use of http is not spec compliant if ( ! url . toLowerCase ( ) . startsWith ( "https:" ) && config . isHttpsRequired ( ) ) { Tr . error ( tc , "OIDC_CLIENT_URL_PROTOCOL_NOT_HTTPS" , new Object [ ] { url } ) ; return null ; } OidcClientUtil oidccu = new OidcClientUtil ( ) ; int statusCode = 0 ; String responseStr = null ; try { boolean useSysProps = config . getUseSystemPropertiesForHttpClientConnections ( ) ; Map < String , Object > resultMap = oidccu . getUserinfo ( url , accessToken , sslsf , hostnameVerification , useSysProps ) ; if ( resultMap == null ) { throw new Exception ( "result map from getUserinfo is null" ) ; } HttpResponse response = ( HttpResponse ) resultMap . get ( ClientConstants . RESPONSEMAP_CODE ) ; if ( response == null ) { throw new Exception ( "HttpResponse from getUserinfo is null" ) ; } statusCode = response . getStatusLine ( ) . getStatusCode ( ) ; responseStr = EntityUtils . toString ( response . getEntity ( ) , "UTF-8" ) ; } catch ( Exception ex ) { //ffdc } if ( statusCode != 200 ) { Tr . error ( tc , "USERINFO_RETREIVE_FAILED" , new Object [ ] { url , Integer . toString ( statusCode ) , responseStr } ) ; return null ; } return responseStr ; }
Obtain userInfo from an OIDC provider