Package com.novell.ldap

Examples of com.novell.ldap.LDAPEntry


              LDAPConnection.SCOPE_SUB,
              "(&(objectclass=person)(cn=biadmin))",
              attrIDs,false);
         
          // popolamento userAttributes con attributeName e attributeValue
          LDAPEntry entry = null;
          LDAPAttributeSet attributeSet = null;
          if (searchResults.hasMore()) {
                try {
                    entry = searchResults.next();
                }catch(LDAPException e) {
                  e.printStackTrace();
                    System.out.println("errore in UserContext:: getUserAttributes: " + e.getMessage());
                }           
          }
           
            if (entry != null) {
              attributeSet = entry.getAttributeSet();
              String[] ou=entry.getAttribute("ou").getStringValueArray();
             
            userAttributes.add(ou[0]);             
            userAttributes.add(ou[1]);
                       
            }
View Full Code Here


              LDAPConnection.SCOPE_SUB,
              "(objectclass=organizationalUnit)",
              attrIDs,false);
         
          // popolamento userAttributes con attributeName e attributeValue
          LDAPEntry entry = null;
          LDAPAttributeSet attributeSet = null;
          while (searchResults.hasMore()){

                try {
                    entry = searchResults.next();
                    if (entry != null) {
                attributeSet = entry.getAttributeSet();
              groups.add(attributeSet.getAttribute("ou").getStringValue());
                    }
                }catch(LDAPException e) {
                  e.printStackTrace();
                    System.out.println("errore in UserContext:: getUserAttributes: " + e.getMessage());
View Full Code Here

  if (connection != null) {
      try {
    LDAPSearchResults searchResults = connection.search(searchRoot, LDAPConnection.SCOPE_SUB,
      "(&(objectclass=" + objectClass + ")(cn=" + userId + "))", attrIDs, false);

    LDAPEntry entry = null;
    if (searchResults.hasMore()) {
        try {
      entry = searchResults.next();
        } catch (LDAPException e) {
      logger.error("LDAPException",e);
        }

        if (entry != null) {
      userAttributes.put("dn", entry.getDN());
      for (int i = 0; i < attrIDs.length; i++) {
          String attr = attrIDs[i];
          userAttributes.put(attr, entry.getAttribute(attr).getStringValue());
      }

        }
    }
      } catch (LDAPException e) {
View Full Code Here

    attributes[0] = ouAttributeName;
    LDAPSearchResults searchResults = connection.search(searchRoot, LDAPConnection.SCOPE_SUB,
      "(&(objectclass=" + objectClass + ")(cn=" + userId + "))", attributes, false);

    // popolamento userAttributes con attributeName e attributeValue
    LDAPEntry entry = null;
    if (searchResults.hasMore()) {
        try {
      entry = searchResults.next();
        } catch (LDAPException e) {
      logger.error("LDAPException",e);
      throw e;
        }
        if (entry != null) {
      String[] ou = entry.getAttribute(ouAttributeName).getStringValueArray();
      for (int i = 0; i < ou.length; i++) {
          if (ou[i].indexOf("=") > 0) {
        String[] appUserOUs = LDAPDN.explodeDN(ou[i], false);
        for (int j = appUserOUs.length - 1; j >= 0; j--) {
            String s = appUserOUs[j];
View Full Code Here

      try {

    LDAPSearchResults searchResults = connection.search(searchRootGroup, LDAPConnection.SCOPE_SUB,
      "(objectclass=" + objectClassGroup + ")", attrIDsGroup, false);

    LDAPEntry entry = null;
    LDAPAttributeSet attributeSet = null;
    while (searchResults.hasMore()) {

        try {
      entry = searchResults.next();
      if (entry != null) {
          attributeSet = entry.getAttributeSet();
          groups.add(attributeSet.getAttribute(ouAttributeName).getStringValue());

      }
        } catch (LDAPException e) {
      logger.error("LDAPException",e);
View Full Code Here

      false);

    int icnt = 0;
    if (rs != null) {
      while (rs.hasMore()) {
        LDAPEntry entry = rs.next();
        if (entry.getAttribute("sAMAccountName") != null) {
          System.out.println(icnt++ + "X " +
            entry.getAttribute("sAMAccountName") + " " +
            entry.getAttribute("DisplayName") + " ");
        }
      }
    }

    conn.disconnect();
View Full Code Here

      LDAPSearchResults rs = conn.search("ou=skymobi,dc=sky-mobi,dc=com", 2,
        "(sAMAccountName=*)", new String[] { "sAMAccountName",
        "displayName" }, false);
      if (rs != null)
        while (rs.hasMore()) {
          LDAPEntry entry = rs.next();
          try {
            userMap.put(entry.getAttribute("sAMAccountName")
              .getStringValue().toLowerCase(), entry.getAttribute("displayName")
              .getStringValue());
          } catch (Exception localException) {
          }
        }
    }
View Full Code Here

      LDAPAttributeSet attributeSet = new LDAPAttributeSet();
      attributeSet.add(new LDAPAttribute("objectClass", "person"));
      attributeSet.add(new LDAPAttribute("cn", "exo"));
      attributeSet.add(new LDAPAttribute("sn", "platform"));
      attributeSet.add(new LDAPAttribute("telephonenumber", "0989654990"));
      LDAPEntry newEntry = new LDAPEntry(EXO_DEVELOPER_DN, attributeSet);
      conn.add(newEntry);
      System.out.println("<======Added object: " + EXO_DEVELOPER_DN + " successfully.");

      System.out.println("\nAdded object: " + EXO_DEVELOPER_DN + " successfully.");

      LDAPSearchResults results = conn.search(DEVELOPER_UNIT_DN, // search only
         // the object in
         // the subtree of
         // this dn
         LDAPConnection.SCOPE_SUB, // return
         // all the
         // objects
         // that
         // match
         // the
         // filter
         // criteria
         // and in
         // the sub
         // tree
         "(objectclass=person)", // query
         // filter, (
         // objectclass
         // =*) for
         // all the
         // object
         null, // return all the attributes
         // of the object
         false); // return attrs and values

      // assertEquals("Expect to find 1 entry", 1, results.getCount()) ;
      while (results.hasMore())
      {
         LDAPEntry nextEntry = null;
         nextEntry = results.next();
         System.out.println("\n entry: " + nextEntry.getDN());
         System.out.println("  Attributes: ");
         LDAPAttributeSet attrs = nextEntry.getAttributeSet();
         printLDAPAttributeSet(attrs);
      }
      System.out.println("   ---> count: " + results.getCount());
      System.out.println("<======search " + DEVELOPER_UNIT_DN + " successfully.");
      // delete the new created ldap entry
View Full Code Here

      LDAPAttributeSet attributeSet = new LDAPAttributeSet();
      attributeSet.add(new LDAPAttribute("objectClass", "person"));
      attributeSet.add(new LDAPAttribute("cn", "exo"));
      attributeSet.add(new LDAPAttribute("sn", "platform"));
      attributeSet.add(new LDAPAttribute("telephonenumber", "0989654990"));
      LDAPEntry newEntry = new LDAPEntry(EXO_DEVELOPER_DN, attributeSet);
      conn.add(newEntry);
      System.out.println("<======Added object: " + EXO_DEVELOPER_DN + " successfully.");

      System.out.println("\nAdded object: " + EXO_DEVELOPER_DN + " successfully.");

      LDAPSearchResults results = conn.search(DEVELOPER_UNIT_DN, // search only
         // the object in
         // the subtree of
         // this dn
         LDAPConnection.SCOPE_SUB, // return
         // all the
         // objects
         // that
         // match
         // the
         // filter
         // criteria
         // and in
         // the sub
         // tree
         "(objectclass=person)", // query
         // filter, (
         // objectclass
         // =*) for
         // all the
         // object
         null, // return all the attributes
         // of the object
         false); // return attrs and values

      // assertEquals("Expect to find 1 entry", 1, results.getCount()) ;
      while (results.hasMore())
      {
         LDAPEntry nextEntry = null;
         nextEntry = results.next();
         System.out.println("\n entry: " + nextEntry.getDN());
         System.out.println("  Attributes: ");
         LDAPAttributeSet attrs = nextEntry.getAttributeSet();
         printLDAPAttributeSet(attrs);
      }
      System.out.println("   ---> count: " + results.getCount());
      System.out.println("<======search " + DEVELOPER_UNIT_DN + " successfully.");
      // delete the new created ldap entry
View Full Code Here

  }

  // 根据sn取得邮箱地址
  public static String getLDAPEmailBySN(String user) {
    String mail = null;
    LDAPEntry fullEntry = null;
    LDAPConnection lc = null;
    LDAPAttributeSet set = null;
    LDAPSearchResults rs = null;

    try {
      lc = getConnection();

      rs = lc.search(ENTRYDN, LDAPConnection.SCOPE_SUB, "sn=" + user,
          attrNames, false);

      while (rs.hasMore()) {
        try {
          fullEntry = rs.next();
          set = fullEntry.getAttributeSet();
          Iterator<?> attrs = set.iterator();
          while (attrs.hasNext()) {
            LDAPAttribute attribute = (LDAPAttribute) attrs.next();
            String name = attribute.getName();
            String value = attribute.getStringValue();
View Full Code Here

TOP

Related Classes of com.novell.ldap.LDAPEntry

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.