Search code examples
ldapjndi

How to show all attributes definition present in LDAP schema using JNDI


I want to show all attributes definition present in LDAP schema to user.

DirContext schema = ctx.getSchema("");

Attributes answer = schema.getAttributes("AttributeDefinition/telephonenumber");

This code gives description about one attribute at a time and user also needs to know name of attribute. I want to show list of all attributes present in schema.

Can anyone please provide me sample code to show all attributes in LDAP directory using JNDI APIs?


Solution

  • take a look at this answer and use entry.get( "attributeTypes" ) to get all the attribute types