Search in sources :

Example 11 with BasePersistenceException

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

the class ConfigurationFactory method loadConfigurationFromDb.

@Override
protected LdapOxTrustConfiguration loadConfigurationFromDb(String... returnAttributes) {
    final PersistenceEntryManager persistenceEntryManager = persistenceEntryManagerInstance.get();
    final String configurationDn = getConfigurationDn();
    try {
        final LdapOxTrustConfiguration conf = persistenceEntryManager.find(configurationDn, LdapOxTrustConfiguration.class, returnAttributes);
        return conf;
    } catch (BasePersistenceException ex) {
        log.error("Failed to load configuration from LDAP", ex);
    }
    return null;
}
Also used : PersistenceEntryManager(org.gluu.persist.PersistenceEntryManager) LdapOxTrustConfiguration(org.gluu.config.oxtrust.LdapOxTrustConfiguration) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException)

Example 12 with BasePersistenceException

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

the class OrganizationService method getOxAuthSetting.

public LdapOxAuthConfiguration getOxAuthSetting(String configurationDn) {
    LdapOxAuthConfiguration ldapOxAuthConfiguration = null;
    try {
        configurationDn = configurationDn.replace("ou=oxtrust", "ou=oxauth");
        ldapOxAuthConfiguration = persistenceEntryManager.find(LdapOxAuthConfiguration.class, configurationDn);
        return ldapOxAuthConfiguration;
    } 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)

Example 13 with BasePersistenceException

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

the class JsonConfigurationService method loadFido2Configuration.

public DbApplicationConfiguration loadFido2Configuration() {
    try {
        String configurationDn = configurationFactory.getBaseConfiguration().getString("fido2_ConfigurationEntryDN");
        DbApplicationConfiguration conf = persistenceEntryManager.find(DbApplicationConfiguration.class, configurationDn);
        return conf;
    } catch (BasePersistenceException ex) {
        log.error("Failed to load Fido2 configuration from LDAP");
    }
    return null;
}
Also used : BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) DbApplicationConfiguration(org.gluu.config.oxtrust.DbApplicationConfiguration)

Example 14 with BasePersistenceException

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

the class CacheRefreshTimer method updateTargetEntriesViaVDS.

private List<String> updateTargetEntriesViaVDS(CacheRefreshConfiguration cacheRefreshConfiguration, LdapServerConnection targetServerConnection, Set<String> changedInums) {
    List<String> result = new ArrayList<String>();
    PersistenceEntryManager targetPersistenceEntryManager = targetServerConnection.getPersistenceEntryManager();
    Filter filter = cacheRefreshService.createObjectClassPresenceFilter();
    for (String changedInum : changedInums) {
        String baseDn = "action=synchronizecache," + personService.getDnForPerson(changedInum);
        try {
            targetPersistenceEntryManager.findEntries(baseDn, DummyEntry.class, filter, SearchScope.SUB, null, null, 0, 0, cacheRefreshConfiguration.getLdapSearchSizeLimit());
            result.add(changedInum);
            log.debug("Updated entry with inum {}", changedInum);
        } catch (BasePersistenceException ex) {
            log.error("Failed to update entry with inum '{}' using baseDN {}", changedInum, baseDn, ex);
        }
    }
    return result;
}
Also used : PersistenceEntryManager(org.gluu.persist.PersistenceEntryManager) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) Filter(org.gluu.search.filter.Filter) ArrayList(java.util.ArrayList)

Example 15 with BasePersistenceException

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

the class UserProfileAction method update.

public String update() {
    try {
        if (appConfiguration.getEnforceEmailUniqueness() && !dataSourceTypeService.isLDAP(personService.getDnForPerson(null))) {
            if (!userEmailIsUniqAtEditionTime(this.person.getAttribute("mail"))) {
                facesMessages.add(FacesMessage.SEVERITY_ERROR, "#{msgs['UpdatePersonAction.faileUpdateUserMailidExist']} %s", person.getMail());
                return OxTrustConstants.RESULT_FAILURE;
            }
        }
        GluuCustomPerson person = this.person;
        person.setGluuOptOuts(optOuts.size() == 0 ? null : optOuts);
        boolean runScript = externalUpdateUserService.isEnabled();
        if (runScript) {
            externalUpdateUserService.executeExternalUpdateUserMethods(this.person);
        }
        personService.updatePerson(this.person);
        oxTrustAuditService.audit(this.person.getInum() + " **" + this.person.getDisplayName() + "** PROFILE UPDATED", identity.getUser(), (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest());
        if (runScript) {
            externalUpdateUserService.executeExternalPostUpdateUserMethods(this.person);
        }
    } catch (DuplicateEmailException ex) {
        log.error("Failed to update profile {}", person.getInum(), ex);
        facesMessages.add(FacesMessage.SEVERITY_ERROR, ex.getMessage());
        return OxTrustConstants.RESULT_FAILURE;
    } catch (BasePersistenceException ex) {
        log.error("Failed to update profile {}", person.getInum(), ex);
        facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update profile '#{userProfileAction.person.displayName}'");
        return OxTrustConstants.RESULT_FAILURE;
    } catch (Exception ex) {
        log.error("Failed to update profile {}", person.getInum(), ex);
        facesMessages.add(FacesMessage.SEVERITY_ERROR, "Failed to update profile '#{userProfileAction.person.displayName}'");
        return OxTrustConstants.RESULT_FAILURE;
    }
    facesMessages.add(FacesMessage.SEVERITY_INFO, "Profile '#{userProfileAction.person.displayName}' updated successfully");
    return OxTrustConstants.RESULT_SUCCESS;
}
Also used : GluuCustomPerson(org.gluu.oxtrust.model.GluuCustomPerson) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) DuplicateEmailException(org.gluu.oxtrust.exception.DuplicateEmailException) BasePersistenceException(org.gluu.persist.exception.BasePersistenceException) DuplicateEmailException(org.gluu.oxtrust.exception.DuplicateEmailException)

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