attribute « ldap « Java Enterprise Q&A

1. How can I access the attributes of this LDAP object?

I'm hoping someone can help me understand how to work with the object returned by a call to DirContext.lookup. The following code snippet works and returns an object. I just can't figure ...

2. Java Netscape LDAP Remove One Attribute

I have LDAP schema where are users. I need remove one attribute named "notify" which have values: phone number or mail or remove attribute from user. I found method

LDAPConnection myCon = ...

3. How to add an self defined attribute to ldap user?

I have created an attribute in LDAP using the following code.

attrs.put("NUMERICOID", "");
            attrs.put("NAME", "myattribute");

4. LDAP Query URL - how to refer an attribute?

I have set up some database connection parameters on an OpenDS ldap server, using my own schema. It looks as the attached screenshot. when I try to query the LDAP using ...

5. Extracting multi-valued attribute from LDAP groupOfUniqueNames

I'm trying to read all members who belong to group defined in LDAP as groupOfUniqueNames.

String url = "ldap://blah.blah.address:389/dc=foo,dc=bar";
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, url);

DirContext ctx = new InitialDirContext(env);
String[] attrIDs ...

6. Why is the userPassword attribute null for some users when I query all users in an Active Directory group through LDAP?

Here is the code I use:

Hashtable<String, String> environment = new Hashtable<String, String>();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
environment.put(Context.SECURITY_PRINCIPAL, "Administrator@ABC");
environment.put(Context.SECURITY_CREDENTIALS, "testing123");
environment.put(Context.PROVIDER_URL, "ldap://");
DirContext dirContext = new InitialDirContext(environment);
SearchControls searchControls = new SearchControls();
NamingEnumeration searchResults ="cn=users,dc=ABC,dc=DEF,dc=COM", "(&(objectClass=user))", searchControls);
while (searchResults.hasMore()) {

7. Unboundid LDAP SDK - how to process an attribute value consisting of several values?

If you have an attribute which value consists of a comma-separated list of values, which would be the best way to retrieve some part of that value? Example:

myAttribute: value1, value2, ...

9. Changing LDAP "Search Attribute"

Hello: I am authenticating against LDAP as such: Hashtable authEnv = new Hashtable(); String dn = "CN=" + userAuth.getFirstName() + " " + userAuth.getLastName() + ",OU=zzzzzzzz,DC=yyyyy,DC=xxx"; authEnv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); authEnv.put(Context.PROVIDER_URL, "ldap://"); authEnv.put(Context.SECURITY_AUTHENTICATION, "simple"); authEnv.put(Context.SECURITY_PRINCIPAL, dn); authEnv.put(Context.SECURITY_CREDENTIALS, password); I am using the user's first and last name to authenticate. Now, I want to use their login id to authenticate. I was told "to ...

11. Get value for LDAP Attribute "userPassword" of type binary using Java1.4

Hi, I am using Sun Java 1.4 and trying to extract the value of an LDAP attribute "userPassword" which is of type binary. While doing this I get an value which is different than the password stored in the IBM Tivoli v5 for eg "[B@61db22" rather the encrypted string in SHA1. Could any help me out with this. The snap shot ...

12. using string value as variable name for ldap attribute

Since I'm reading all the attributes from an existing object, I don't know them before hand. So if I had an ArrayList of Strings where the first value is the attribute name, and the rest of the array had the values (because some could have more than one) how would I use this in the code? Don't do that. You should ...

13. how do you get attributes from LDAP directory

// For each answer found, get its telephonenumber attribute // If relative, resolve relative to target context // If not relative, resolve relative to initial context while (enum.hasMore()) { item = (NameClassPair); System.out.println(">>>>>" + item.getName() + " "); if (item.isRelative()) { attrs = targetCtx.getAttributes(item.getName(), attrIds); } else { attrs = initCtx.getAttributes(item.getName(), attrIds); } System.out.println(attrs);