Search in sources :

Example 11 with AbstractCryptoProvider

use of org.gluu.oxauth.model.crypto.AbstractCryptoProvider in project oxAuth by GluuFederation.

the class ConfigurationFactory method destroyCryptoProviderInstance.

private void destroyCryptoProviderInstance() {
    log.trace("Destroyed crypto provider instance.");
    AbstractCryptoProvider abstractCryptoProvider = abstractCryptoProviderInstance.get();
    abstractCryptoProviderInstance.destroy(abstractCryptoProvider);
    CryptoProviderFactory.reset();
}
Also used : AbstractCryptoProvider(org.gluu.oxauth.model.crypto.AbstractCryptoProvider)

Example 12 with AbstractCryptoProvider

use of org.gluu.oxauth.model.crypto.AbstractCryptoProvider in project oxAuth by GluuFederation.

the class ConfigurationFactory method createFromLdap.

private boolean createFromLdap(boolean recoverFromFiles) {
    log.info("Loading configuration from '{}' DB...", baseConfiguration.getString("persistence.type"));
    try {
        final Conf c = loadConfigurationFromLdap();
        if (c != null) {
            init(c);
            // Destroy old configuration
            if (this.loaded) {
                destroy(AppConfiguration.class);
                destroy(StaticConfiguration.class);
                destroy(WebKeysConfiguration.class);
                destroy(ErrorResponseFactory.class);
            }
            this.loaded = true;
            configurationUpdateEvent.select(ConfigurationUpdate.Literal.INSTANCE).fire(conf);
            destroyCryptoProviderInstance();
            AbstractCryptoProvider newAbstractCryptoProvider = abstractCryptoProviderInstance.get();
            cryptoProviderEvent.select(CryptoProviderEvent.Literal.INSTANCE).fire(newAbstractCryptoProvider);
            return true;
        }
    } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
    }
    if (recoverFromFiles) {
        log.info("Unable to find configuration in LDAP, try to load configuration from file system... ");
        if (createFromFile()) {
            this.loadedFromLdap = false;
            return true;
        }
    }
    return false;
}
Also used : AbstractCryptoProvider(org.gluu.oxauth.model.crypto.AbstractCryptoProvider) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) ConfigurationException(org.gluu.exception.ConfigurationException)

Aggregations

AbstractCryptoProvider (org.gluu.oxauth.model.crypto.AbstractCryptoProvider)12 Test (org.testng.annotations.Test)7 BaseTest (org.gluu.oxauth.BaseTest)6 Jwt (org.gluu.oxauth.model.jwt.Jwt)6 AuthorizationRequest (org.gluu.oxauth.client.AuthorizationRequest)5 AuthorizationResponse (org.gluu.oxauth.client.AuthorizationResponse)5 RegisterClient (org.gluu.oxauth.client.RegisterClient)5 RegisterRequest (org.gluu.oxauth.client.RegisterRequest)5 RegisterResponse (org.gluu.oxauth.client.RegisterResponse)5 ResponseType (org.gluu.oxauth.model.common.ResponseType)5 Parameters (org.testng.annotations.Parameters)5 UserInfoClient (org.gluu.oxauth.client.UserInfoClient)4 UserInfoResponse (org.gluu.oxauth.client.UserInfoResponse)4 Claim (org.gluu.oxauth.client.model.authorize.Claim)4 JwtAuthorizationRequest (org.gluu.oxauth.client.model.authorize.JwtAuthorizationRequest)4 PlainTextSignature (org.gluu.oxauth.model.jws.PlainTextSignature)3 JSONObject (org.json.JSONObject)3 IOException (java.io.IOException)2 ConfigurationException (org.gluu.exception.ConfigurationException)2 AuthorizeClient (org.gluu.oxauth.client.AuthorizeClient)2