use of org.xdi.net.TrustAllTrustManager in project oxAuth by GluuFederation.
the class OpenIdConnectDiscoveryAction method exec.
public void exec() {
try {
ClientExecutor clientExecutor = null;
if (acceptUntrustedCertificate) {
HttpClient httpClient = new SslDefaultHttpClient(new TrustAllTrustManager());
clientExecutor = new ApacheHttpClient4Executor(httpClient);
}
OpenIdConnectDiscoveryRequest openIdConnectDiscoveryRequest = new OpenIdConnectDiscoveryRequest(resource);
host = openIdConnectDiscoveryRequest.getHost();
rel = REL_VALUE;
OpenIdConnectDiscoveryClient openIdConnectDiscoveryClient = new OpenIdConnectDiscoveryClient(resource);
OpenIdConnectDiscoveryResponse openIdConnectDiscoveryResponse;
if (clientExecutor == null) {
openIdConnectDiscoveryResponse = openIdConnectDiscoveryClient.exec();
} else {
openIdConnectDiscoveryResponse = openIdConnectDiscoveryClient.exec(clientExecutor);
}
showResults = true;
requestString1 = openIdConnectDiscoveryClient.getRequestAsString();
responseString1 = openIdConnectDiscoveryClient.getResponseAsString();
if (openIdConnectDiscoveryResponse.getStatus() == 200) {
String openIdConfigurationUrl = openIdConnectDiscoveryResponse.getLinks().get(0).getHref() + "/.well-known/openid-configuration";
OpenIdConfigurationClient openIdConfigurationClient = new OpenIdConfigurationClient(openIdConfigurationUrl);
OpenIdConfigurationResponse openIdConfigurationResponse;
if (clientExecutor == null) {
openIdConfigurationResponse = openIdConfigurationClient.execOpenIdConfiguration();
} else {
openIdConfigurationResponse = openIdConfigurationClient.execOpenIdConfiguration(clientExecutor);
}
requestString2 = openIdConfigurationClient.getRequestAsString();
responseString2 = openIdConfigurationClient.getResponseAsString();
registrationAction.setRegistrationEndpoint(openIdConfigurationResponse.getRegistrationEndpoint());
authorizationAction.setAuthorizationEndpoint(openIdConfigurationResponse.getAuthorizationEndpoint());
authorizationAction.setJwksUri(openIdConfigurationResponse.getJwksUri());
tokenAction.setTokenEndpoint(openIdConfigurationResponse.getTokenEndpoint());
userInfoAction.setUserInfoEndpoint(openIdConfigurationResponse.getUserInfoEndpoint());
checkSessionAction.setCheckSessionEndpoint(openIdConfigurationResponse.getCheckSessionIFrame());
endSessionAction.setEndSessionEndpoint(openIdConfigurationResponse.getEndSessionEndpoint());
}
} catch (IllegalArgumentException e) {
log.error(e.getMessage(), e);
} catch (URISyntaxException e) {
log.error(e.getMessage(), e);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
Aggregations