Search in sources :

Example 6 with ConfigurationException

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;
}
Also used : RegisterRequest(org.gluu.oxauth.client.RegisterRequest) RegisterResponse(org.gluu.oxauth.client.RegisterResponse) ConfigurationException(org.gluu.util.exception.ConfigurationException) RegisterClient(org.gluu.oxauth.client.RegisterClient)

Example 7 with ConfigurationException

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;
}
Also used : OpenIdConfigurationClient(org.gluu.oxauth.client.OpenIdConfigurationClient) ConfigurationException(org.gluu.util.exception.ConfigurationException) OpenIdConfigurationResponse(org.gluu.oxauth.client.OpenIdConfigurationResponse)

Aggregations

ConfigurationException (org.gluu.util.exception.ConfigurationException)7 OpenIdConfigurationClient (org.gluu.oxauth.client.OpenIdConfigurationClient)2 OpenIdConfigurationResponse (org.gluu.oxauth.client.OpenIdConfigurationResponse)2 EncryptionException (org.gluu.util.security.StringEncrypter.EncryptionException)2 IOException (java.io.IOException)1 Properties (java.util.Properties)1 SharedConfigurationEntry (org.gluu.conf.model.SharedConfigurationEntry)1 FileConfiguration (org.gluu.orm.util.properties.FileConfiguration)1 RegisterClient (org.gluu.oxauth.client.RegisterClient)1 RegisterRequest (org.gluu.oxauth.client.RegisterRequest)1 RegisterResponse (org.gluu.oxauth.client.RegisterResponse)1 StandalonePersistanceFactoryService (org.gluu.persist.service.StandalonePersistanceFactoryService)1 CacheConfiguration (org.gluu.service.cache.CacheConfiguration)1 InMemoryConfiguration (org.gluu.service.cache.InMemoryConfiguration)1 StringEncrypter (org.gluu.util.security.StringEncrypter)1