Package com.unboundid.ldap.sdk

Examples of com.unboundid.ldap.sdk.SearchResultEntry


     * @param dn The distinguished name.
     * @return {@code true} if an entry identified by {@code dn} exists. Otherwise, {@code false} is returned.
     */
    public boolean verifyDNExists(final String dn) {
        try {
            final SearchResultEntry entry = connection.getEntry(dn);
            return entry != null;
        } catch (final LDAPException e) {
            throw new DirectoryTesterException("Error communicating with LDAP directory server", e);
        }
    }
View Full Code Here


     *         Otherwise, {@code false} is returned.
     */
    public boolean verifyDNIsA(final String dn,
                               final String objectclass) {
        try {
            final SearchResultEntry entry = connection.getEntry(dn, "objectclass");
            return entry != null
                    && entry.hasAttribute("objectclass")
                    && ArrayUtils.contains(entry.getAttributeValues("objectclass"), objectclass);
        } catch (final LDAPException e) {
            throw new DirectoryTesterException("Error communicating with LDAP directory server", e);
        }
    }
View Full Code Here

     *         {@code attributeName}. Otherwise, {@code false} is returned.
     */
    public boolean verifyDNHasAttribute(final String dn,
                                        final String attributeName) {
        try {
            final SearchResultEntry entry = connection.getEntry(dn, attributeName);
            return entry != null && entry.hasAttribute(attributeName);
        } catch (final LDAPException e) {
            throw new DirectoryTesterException("Error communicating with LDAP directory server", e);
        }
    }
View Full Code Here

     */
    public boolean verifyDNHasAttributeValue(final String dn,
                                             final String attributeName,
                                             final String... attributeValue) {
        try {
            final SearchResultEntry entry = connection.getEntry(dn, attributeName);
            if (entry != null && entry.hasAttribute(attributeName)) {
                final Set<String> expectedValues = new HashSet<String>(Arrays.asList(attributeValue));
                final Set<String> actualValues = new HashSet<String>(Arrays.asList(entry.getAttributeValues(attributeName)));
                if (actualValues.containsAll(expectedValues)) {
                    actualValues.removeAll(expectedValues);
                    if (actualValues.size() == 0) {
                        return true;
                    }
View Full Code Here

        String accountPattern = settings.getString(Keys.realm.ldap.accountPattern, "(&(objectClass=person)(sAMAccountName=${username}))");
        accountPattern = StringUtils.replace(accountPattern, "${username}", escapeLDAPSearchFilter(simpleUsername));

        SearchResult result = doSearch(ldapConnection, accountBase, accountPattern);
        if (result != null && result.getEntryCount() == 1) {
          SearchResultEntry loggingInUser = result.getSearchEntries().get(0);
          String loggingInUserDN = loggingInUser.getDN();

          if (alreadyAuthenticated || isAuthenticated(ldapConnection, loggingInUserDN, new String(password))) {
            logger.debug("LDAP authenticated: " + username);

            UserModel user = null;
View Full Code Here

    }

    SearchResult teamMembershipResult = doSearch(ldapConnection, groupBase, true, groupMemberPattern, Arrays.asList("cn"));
    if (teamMembershipResult != null && teamMembershipResult.getEntryCount() > 0) {
      for (int i = 0; i < teamMembershipResult.getEntryCount(); i++) {
        SearchResultEntry teamEntry = teamMembershipResult.getSearchEntries().get(i);
        String teamName = teamEntry.getAttribute("cn").getValue();

        TeamModel teamModel = userManager.getTeamModel(teamName);
        if (teamModel == null) {
          teamModel = createTeamFromLdap(teamEntry);
        }
View Full Code Here

    String groupMemberPattern = settings.getString(Keys.realm.ldap.groupEmptyMemberPattern, "(&(objectClass=group)(!(member=*)))");

    SearchResult teamMembershipResult = doSearch(ldapConnection, groupBase, true, groupMemberPattern, null);
    if (teamMembershipResult != null && teamMembershipResult.getEntryCount() > 0) {
      for (int i = 0; i < teamMembershipResult.getEntryCount(); i++) {
        SearchResultEntry teamEntry = teamMembershipResult.getSearchEntries().get(i);
        if (!teamEntry.hasAttribute("member")) {
          String teamName = teamEntry.getAttribute("cn").getValue();

          TeamModel teamModel = userManager.getTeamModel(teamName);
          if (teamModel == null) {
            teamModel = createTeamFromLdap(teamEntry);
            userManager.updateTeamModel(teamModel);
View Full Code Here

        String accountPattern = settings.getString(Keys.realm.ldap.accountPattern, "(&(objectClass=person)(sAMAccountName=${username}))");
        accountPattern = StringUtils.replace(accountPattern, "${username}", escapeLDAPSearchFilter(simpleUsername));

        SearchResult result = doSearch(ldapConnection, accountBase, accountPattern);
        if (result != null && result.getEntryCount() == 1) {
          SearchResultEntry loggingInUser = result.getSearchEntries().get(0);
          String loggingInUserDN = loggingInUser.getDN();

          if (alreadyAuthenticated || isAuthenticated(ldapConnection, loggingInUserDN, new String(password))) {
            logger.debug("LDAP authenticated: " + username);

            UserModel user = null;
View Full Code Here

    }

    SearchResult teamMembershipResult = doSearch(ldapConnection, groupBase, true, groupMemberPattern, Arrays.asList("cn"));
    if (teamMembershipResult != null && teamMembershipResult.getEntryCount() > 0) {
      for (int i = 0; i < teamMembershipResult.getEntryCount(); i++) {
        SearchResultEntry teamEntry = teamMembershipResult.getSearchEntries().get(i);
        String teamName = teamEntry.getAttribute("cn").getValue();

        TeamModel teamModel = userManager.getTeamModel(teamName);
        if (teamModel == null) {
          teamModel = createTeamFromLdap(teamEntry);
        }
View Full Code Here

    String groupMemberPattern = settings.getString(Keys.realm.ldap.groupEmptyMemberPattern, "(&(objectClass=group)(!(member=*)))");

    SearchResult teamMembershipResult = doSearch(ldapConnection, groupBase, true, groupMemberPattern, null);
    if (teamMembershipResult != null && teamMembershipResult.getEntryCount() > 0) {
      for (int i = 0; i < teamMembershipResult.getEntryCount(); i++) {
        SearchResultEntry teamEntry = teamMembershipResult.getSearchEntries().get(i);
        if (!teamEntry.hasAttribute("member")) {
          String teamName = teamEntry.getAttribute("cn").getValue();

          TeamModel teamModel = userManager.getTeamModel(teamName);
          if (teamModel == null) {
            teamModel = createTeamFromLdap(teamEntry);
            userManager.updateTeamModel(teamModel);
View Full Code Here

TOP

Related Classes of com.unboundid.ldap.sdk.SearchResultEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.