Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show all objectclasses description of ldap directory using jndi

Tags:

java

ldap

jndi

I want to show all objectclasses present in schema of LDAP Directory to help user to input available objectclasses for adding new entry.

DirContext schema = ctx.getSchema("");
Attributes answer = schema.getAttributes("ClassDefinition/person");

but that shows information about person only.

like image 728
pankaj Avatar asked Mar 11 '11 12:03

pankaj


People also ask

Does LDAP use JNDI?

Both the JNDI and LDAP models define a hierarchical namespace in which you name objects. Each object in the namespace may have attributes that can be used to search for the object. At this high level, the two models are similar, so it is not surprising that the JNDI maps well to the LDAP.

What is objectClass attribute in LDAP?

ObjectClass attribute specifies the object classes of an entry, which (among other things) are used in conjunction with the controlling schema to determine the permitted attributes of an entry. Values of this attribute can be modified by clients, but the 'objectClass' attribute cannot be removed.

What is schema in LDAP?

A directory schema specifies, among other rules, the types of objects that a directory may have and the mandatory and optional attributes of each object type. The Lightweight Directory Access Protocol (LDAP) version 3 defines a schema based on the X.

What is objectClass top?

top is an abstract object class that is the parent of every LDAP object class. It is the one that defines that every object in LDAP must have an objectClass attribute.


1 Answers

DirContext schema=dcx.getSchema("");
NamingEnumeration bindings = schema.listBindings("ClassDefinition");
while (bindings.hasMore())
{
    Binding bd = (Binding)bindings.next();
    System.out.println(bd.getName() + ": " + bd.getObject());
}

You can use various other bindings like

  • AttributeDefinition
  • ClassDefinition
  • SyntaxDefinition

Schema context may also provide bindings like
  • MatchingRule
  • ExtensionDefinition
  • ControlDefinition
  • SASLDefinition
like image 54
pankaj rathod Avatar answered Sep 21 '22 19:09

pankaj rathod