Search in sources :

Example 61 with Filter

use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.

the class TrustedIDPService method getTrustedIDPByRemoteIdpHost.

public OxTrustedIdp getTrustedIDPByRemoteIdpHost(String remoteIdpHost, String... returnAttributes) {
    log.debug("Getting user information from DB: TrustedIDP = {}", remoteIdpHost);
    OxTrustedIdp oxTrustedIdp = null;
    if (StringHelper.isEmpty(remoteIdpHost)) {
        return null;
    }
    String gluuPassportConfigDn = getDnForTrustedIDP(null);
    Filter gluuPassportConfigIdpHostFilter;
    if (dataSourceTypeService.isSpanner(gluuPassportConfigDn)) {
        gluuPassportConfigIdpHostFilter = Filter.createEqualityFilter("remoteIdpHost", StringHelper.toLowerCase(remoteIdpHost));
    } else {
        gluuPassportConfigIdpHostFilter = Filter.createEqualityFilter(Filter.createLowercaseFilter("remoteIdpHost"), StringHelper.toLowerCase(remoteIdpHost));
    }
    List<OxTrustedIdp> entries = persistenceEntryManager.findEntries(gluuPassportConfigDn, OxTrustedIdp.class, gluuPassportConfigIdpHostFilter, returnAttributes);
    log.debug("Found {} entries for TrustedIDP = {}", entries.size(), remoteIdpHost);
    if (entries.size() > 0) {
        oxTrustedIdp = entries.get(0);
    }
    return oxTrustedIdp;
}
Also used : Filter(org.gluu.search.filter.Filter) OxTrustedIdp(org.gluu.oxtrust.model.OxTrustedIdp)

Example 62 with Filter

use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.

the class PersonService method searchPersons.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.gluu.oxtrust.ldap.service.IPersonService#searchPersons(java.lang.String)
	 */
@Override
public List<GluuCustomPerson> searchPersons(String pattern) {
    Filter searchFilter = buildFilter(pattern);
    String[] attributes = { "inum", "uid", "displayName", "mail", "gluuStatus" };
    return persistenceEntryManager.findEntries(getDnForPerson(null), GluuCustomPerson.class, searchFilter, attributes);
}
Also used : Filter(org.gluu.search.filter.Filter)

Example 63 with Filter

use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.

the class Fido2DeviceService method getGluuCustomFidoDeviceById.

public GluuFido2Device getGluuCustomFidoDeviceById(String id, String userId) {
    GluuFido2Device gluuCustomFidoDevice = null;
    try {
        String dn = getDnForFido2Device(id, userId);
        if (StringUtils.isNotEmpty(userId))
            gluuCustomFidoDevice = ldapEntryManager.find(GluuFido2Device.class, dn);
        else {
            Filter filter = Filter.createEqualityFilter("oxId", id);
            gluuCustomFidoDevice = ldapEntryManager.findEntries(dn, GluuFido2Device.class, filter).get(0);
        }
    } catch (Exception e) {
        log.error("Failed to find device by id " + id, e);
    }
    return gluuCustomFidoDevice;
}
Also used : Filter(org.gluu.search.filter.Filter) GluuFido2Device(org.gluu.oxtrust.model.GluuFido2Device) EntryPersistenceException(org.gluu.persist.exception.EntryPersistenceException)

Example 64 with Filter

use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.

the class Fido2DeviceService method findAllFido2Devices.

public List<GluuFido2Device> findAllFido2Devices(GluuCustomPerson person) {
    try {
        String baseDnForU2fDevices = getDnForFido2Device(null, person.getInum());
        Filter inumFilter = Filter.createEqualityFilter(OxTrustConstants.PERSON_INUM, person.getInum());
        return ldapEntryManager.findEntries(baseDnForU2fDevices, GluuFido2Device.class, inumFilter);
    } catch (EntryPersistenceException e) {
        log.warn("No fido2 devices enrolled for " + person.getDisplayName());
        return new ArrayList<>();
    }
}
Also used : Filter(org.gluu.search.filter.Filter) EntryPersistenceException(org.gluu.persist.exception.EntryPersistenceException)

Example 65 with Filter

use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.

the class AttributeService method attributeWithSameNameDontExist.

public boolean attributeWithSameNameDontExist(String name) {
    Filter nameFilter = Filter.createEqualityFilter("name", name);
    List<GluuAttribute> result = persistenceEntryManager.findEntries(getDnForAttribute(null), GluuAttribute.class, nameFilter, null);
    return (result != null && !result.isEmpty()) ? false : true;
}
Also used : Filter(org.gluu.search.filter.Filter) GluuAttribute(org.gluu.model.GluuAttribute)

Aggregations

Filter (org.gluu.search.filter.Filter)122 ArrayList (java.util.ArrayList)34 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)9 EntryPersistenceException (org.gluu.persist.exception.mapping.EntryPersistenceException)7 MappingException (org.gluu.persist.exception.mapping.MappingException)7 EntryPersistenceException (org.gluu.persist.exception.EntryPersistenceException)6 SearchException (org.gluu.persist.exception.operation.SearchException)6 List (java.util.List)5 GluuAttribute (org.gluu.model.GluuAttribute)5 PropertyAnnotation (org.gluu.persist.model.PropertyAnnotation)5 SearchResult (com.unboundid.ldap.sdk.SearchResult)4 ParseException (java.text.ParseException)4 GluuGroup (org.gluu.oxtrust.model.GluuGroup)4 PersistenceEntryManager (org.gluu.persist.PersistenceEntryManager)4 AuthenticationException (org.gluu.persist.exception.operation.AuthenticationException)4 ConnectionException (org.gluu.persist.exception.operation.ConnectionException)4 SearchScopeException (org.gluu.persist.exception.operation.SearchScopeException)4 GluuAttribute (org.xdi.model.GluuAttribute)4 SearchResultEntry (com.unboundid.ldap.sdk.SearchResultEntry)3 Date (java.util.Date)3