Search in sources :

Example 16 with BasePersistenceException

use of org.gluu.persist.exception.BasePersistenceException in project oxTrust by GluuFederation.

the class ManageCertificateAction method updateTrustCertificates.

private boolean updateTrustCertificates() {
    try {
        GluuConfiguration tmpConfiguration = configurationService.getConfiguration();
        TrustStoreConfiguration currTrustStoreConfiguration = tmpConfiguration.getTrustStoreConfiguration();
        List<TrustStoreCertificate> currTrustStoreCertificates = tmpConfiguration.getTrustStoreCertificates();
        if (currTrustStoreCertificates == null) {
            currTrustStoreCertificates = new ArrayList<TrustStoreCertificate>(0);
        }
        if (!trustStoreConfiguration.equals(currTrustStoreConfiguration) || !trustStoreCertificates.equals(currTrustStoreCertificates)) {
            this.wereAnyChanges = true;
        }
        tmpConfiguration.setTrustStoreConfiguration(trustStoreConfiguration);
        if (trustStoreCertificates.size() == 0) {
            tmpConfiguration.setTrustStoreCertificates(null);
        } else {
            tmpConfiguration.setTrustStoreCertificates(trustStoreCertificates);
        }
        configurationService.updateConfiguration(tmpConfiguration);
    } catch (BasePersistenceException ex) {
        log.error("Failed to update configuration configuration", ex);
        facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update configuration");
        return false;
    }
    return true;
}
Also used : TrustStoreConfiguration(org.gluu.oxtrust.model.cert.TrustStoreConfiguration) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) TrustStoreCertificate(org.gluu.oxtrust.model.cert.TrustStoreCertificate) GluuConfiguration(org.gluu.oxtrust.model.GluuConfiguration)

Example 17 with BasePersistenceException

use of org.gluu.persist.exception.BasePersistenceException in project oxTrust by GluuFederation.

the class UpdateGroupAction method add.

public String add() throws Exception {
    if (this.group != null) {
        return OxTrustConstants.RESULT_SUCCESS;
    }
    this.update = false;
    this.group = new GluuGroup();
    this.group.setOwner(identity.getUser().getDn());
    this.group.setOrganization(organizationService.getOrganization().getDn());
    this.group.setStatus(GluuStatus.ACTIVE);
    try {
        this.members = getMemberDisplayNameEntiries();
    } catch (BasePersistenceException ex) {
        log.error("Failed to prepare lists", ex);
        facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to add new group");
        conversationService.endConversation();
        return OxTrustConstants.RESULT_FAILURE;
    }
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) GluuGroup(org.gluu.oxtrust.model.GluuGroup)

Example 18 with BasePersistenceException

use of org.gluu.persist.exception.BasePersistenceException in project oxTrust by GluuFederation.

the class UpdateScopeAction method add.

public String add() throws Exception {
    if (this.scope != null) {
        return OxTrustConstants.RESULT_SUCCESS;
    }
    this.update = false;
    this.scope = new Scope();
    this.scope.setScopeType(ScopeType.OAUTH);
    try {
        if (this.scope.getOxAuthClaims() != null && this.scope.getOxAuthClaims().size() > 0) {
            this.claims = getClaimDisplayNameEntiries();
        } else {
            this.claims = new ArrayList<DisplayNameEntry>();
        }
    } catch (BasePersistenceException ex) {
        log.error("Failed to load scopes", ex);
        facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to add new scope");
        conversationService.endConversation();
        return OxTrustConstants.RESULT_FAILURE;
    }
    this.dynamicScripts = getInitialDynamicScripts();
    fillAvailableDynScript();
    this.oxAttributesJson = getScopeAttributesJson();
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : Scope(org.oxauth.persistence.model.Scope) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) DisplayNameEntry(org.gluu.model.DisplayNameEntry)

Example 19 with BasePersistenceException

use of org.gluu.persist.exception.BasePersistenceException in project oxTrust by GluuFederation.

the class UpdateOrganizationAction method initOxAuthSetting.

private void initOxAuthSetting() {
    String configurationDn = configurationFactory.getConfigurationDn();
    try {
        ldapOxAuthConfiguration = organizationService.getOxAuthSetting(configurationDn);
        this.webKeysSettings = ldapOxAuthConfiguration.getOxWebKeysSettings();
        if (webKeysSettings == null) {
            webKeysSettings = new WebKeysSettings();
        }
    } catch (BasePersistenceException ex) {
        log.error("Failed to load configuration from LDAP");
    }
}
Also used : BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) WebKeysSettings(org.gluu.config.oxauth.WebKeysSettings)

Example 20 with BasePersistenceException

use of org.gluu.persist.exception.BasePersistenceException in project oxTrust by GluuFederation.

the class JsonConfigurationService method loadOxAuthConfig.

private LdapOxAuthConfiguration loadOxAuthConfig(String configurationDn) {
    try {
        configurationDn = configurationDn.replace("ou=oxtrust", "ou=oxauth");
        LdapOxAuthConfiguration conf = persistenceEntryManager.find(LdapOxAuthConfiguration.class, configurationDn);
        return conf;
    } catch (BasePersistenceException ex) {
        log.error("Failed to load configuration from LDAP");
    }
    return null;
}
Also used : BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) LdapOxAuthConfiguration(org.gluu.config.oxtrust.LdapOxAuthConfiguration)

Aggregations

BasePersistenceException (org.gluu.persist.exception.BasePersistenceException)22 ArrayList (java.util.ArrayList)4 PersistenceEntryManager (org.gluu.persist.PersistenceEntryManager)4 GluuConfiguration (org.gluu.oxtrust.model.GluuConfiguration)3 OxAuthClient (org.gluu.oxtrust.model.OxAuthClient)3 LdapOxAuthConfiguration (org.gluu.config.oxtrust.LdapOxAuthConfiguration)2 SelectableEntity (org.gluu.model.SelectableEntity)2 CustomScript (org.gluu.model.custom.script.model.CustomScript)2 Scope (org.oxauth.persistence.model.Scope)2 IOException (java.io.IOException)1 Date (java.util.Date)1 WebKeysSettings (org.gluu.config.oxauth.WebKeysSettings)1 DbApplicationConfiguration (org.gluu.config.oxtrust.DbApplicationConfiguration)1 LdapOxTrustConfiguration (org.gluu.config.oxtrust.LdapOxTrustConfiguration)1 DisplayNameEntry (org.gluu.model.DisplayNameEntry)1 UmaResource (org.gluu.oxauth.model.uma.persistence.UmaResource)1 DuplicateEmailException (org.gluu.oxtrust.exception.DuplicateEmailException)1 GluuInumMap (org.gluu.oxtrust.ldap.cache.model.GluuInumMap)1 GluuSimplePerson (org.gluu.oxtrust.ldap.cache.model.GluuSimplePerson)1 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)1