use of org.gluu.util.exception.ConfigurationException in project oxTrust by GluuFederation.
the class OpenIdClient method registerOpenIdClient.
private RegisterResponse registerOpenIdClient() {
logger.info("Registering OpenId client");
String clientName = this.appConfiguration.getApplicationName() + " client";
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, clientName, Arrays.asList(this.appConfiguration.getOpenIdRedirectUrl()));
registerRequest.setRequestObjectSigningAlg(SignatureAlgorithm.RS256);
registerRequest.setTokenEndpointAuthMethod(AuthenticationMethod.CLIENT_SECRET_BASIC);
RegisterClient registerClient = new RegisterClient(openIdConfiguration.getRegistrationEndpoint());
registerClient.setRequest(registerRequest);
RegisterResponse response = registerClient.exec();
if ((response == null) || (response.getStatus() != 200)) {
throw new ConfigurationException("Failed to register new client");
}
return response;
}
use of org.gluu.util.exception.ConfigurationException in project oxTrust by GluuFederation.
the class OpenIdClient method loadOpenIdConfiguration.
private void loadOpenIdConfiguration() throws IOException {
String openIdProvider = appConfiguration.getOpenIdProviderUrl();
if (StringHelper.isEmpty(openIdProvider)) {
throw new ConfigurationException("OpenIdProvider Url is invalid");
}
final OpenIdConfigurationClient openIdConfigurationClient = new OpenIdConfigurationClient(openIdProvider);
final OpenIdConfigurationResponse response = openIdConfigurationClient.execOpenIdConfiguration();
if ((response == null) || (response.getStatus() != 200)) {
throw new ConfigurationException("Failed to load oxAuth configuration");
}
logger.info("Successfully loaded oxAuth configuration");
this.openIdConfiguration = response;
}
Aggregations