Search in sources :

Example 21 with LdapNoSuchObjectException

use of org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException in project aws-iam-ldap-bridge by denismo.

the class LDAPIAMPoller method getExistingGroup.

private Entry getExistingGroup(Group iamGroup) throws Exception {
    Dn dn = directory.getDnFactory().create(String.format(GROUP_FMT, iamGroup.getGroupName()));
    LookupOperationContext lookupContext = new LookupOperationContext(directory.getAdminSession(), dn, SchemaConstants.ALL_USER_ATTRIBUTES, SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES);
    try {
        Entry groupEntry = directory.getPartitionNexus().lookup(lookupContext);
        if (groupEntry != null && groupEntry.hasObjectClass("iamgroup")) {
            return groupEntry;
        }
    } catch (LdapNoSuchObjectException e) {
    // Fallthrough
    }
    return null;
}
Also used : LdapNoSuchObjectException(org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException) Dn(org.apache.directory.api.ldap.model.name.Dn) LookupOperationContext(org.apache.directory.server.core.api.interceptor.context.LookupOperationContext)

Aggregations

LdapNoSuchObjectException (org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException)21 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)19 LdapConnection (org.apache.directory.ldap.client.api.LdapConnection)19 Entry (org.apache.directory.api.ldap.model.entry.Entry)17 FinderException (org.apache.directory.fortress.core.FinderException)17 DefaultEntry (org.apache.directory.api.ldap.model.entry.DefaultEntry)16 LdapAttributeInUseException (org.apache.directory.api.ldap.model.exception.LdapAttributeInUseException)3 ArrayList (java.util.ArrayList)2 Properties (java.util.Properties)2 DefaultModification (org.apache.directory.api.ldap.model.entry.DefaultModification)2 Modification (org.apache.directory.api.ldap.model.entry.Modification)2 LdapInvalidAttributeValueException (org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException)2 Permission (org.apache.directory.fortress.core.model.Permission)2 AuthenticationException (javax.naming.AuthenticationException)1 AuthenticationNotSupportedException (javax.naming.AuthenticationNotSupportedException)1 CommunicationException (javax.naming.CommunicationException)1 ContextNotEmptyException (javax.naming.ContextNotEmptyException)1 InvalidNameException (javax.naming.InvalidNameException)1 NameAlreadyBoundException (javax.naming.NameAlreadyBoundException)1 NameNotFoundException (javax.naming.NameNotFoundException)1