Wednesday, January 27, 2021

FileNet and Ldap connectivity - java code to get Active Directory Connection

 

//Connecting to LDAP using java code

String rootDN = "CN=xyz,CN=xyz,DC=xyz,DC=xyz";

        String rootPWD = "*****";

        Hashtable<String, String> environment = new Hashtable<String, String>();

        environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");

        environment.put(Context.PROVIDER_URL, "<ldapurl>");

        environment.put(Context.SECURITY_AUTHENTICATION, "authentications type");

        environment.put(Context.SECURITY_PRINCIPAL, rootDN);

        environment.put(Context.SECURITY_CREDENTIALS, rootPWD);

        DirContext dirContext = null;

        NamingEnumeration<?> results = null;

dirContext = new InitialDirContext(environment);

No comments:

Post a Comment