javax.naming.directory.InitialDirContext
Javascript example:
importPackage(javax.naming); var props = {}; props[Context.INITIAL_CONTEXT_FACTORY] = "com.sun.jndi.ldap.LdapCtxFactory"; props[Context.PROVIDER_URL] = "ldap://192.168.0.33:389"; props[Context.SECURITY_PRINCIPAL] = "Administrator@ebase"; props[Context.SECURITY_CREDENTIALS] = "*******"; props[Context.SECURITY_AUTHENTICATION] = "simple"; var ctx; try { ctx = LdapServices.getLdapContext(props); ctx.search(...); } finally { ctx.close(); }
returns javax.naming.directory.DirContext
javax.naming.directory.InitialDirContext
object using the supplied properties. Note that the context object should be closed after use.Javascript example: