Add Phone to AD User via Java

Asked

Viewed 38 times

1

Only thing I got so far was to connect in AD with the following code:

                String enderecoLdap = paramLDAP.get("SERVER_URLS");
            LOGGER.info(enderecoLdap);
            if( ! enderecoLdap.toLowerCase().startsWith("ldap") ) enderecoLdap = "ldap://" + enderecoLdap;

            String sNomAdmin        = "user";
            String sSenhaAdmin      = "senha";

            String sDesChaveNome    = "name";
            String sDesChaveEmail   = "mail";
            enderecoLdap = "ldap://oinco.secreto.br:389";

            Hashtable<String, Object> ldapEnv = new Hashtable<String, Object>(11);
            ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");

            /* Specify host and port to use for directory service */
            ldapEnv.put(Context.PROVIDER_URL, enderecoLdap);
            ldapEnv.put(Context.SECURITY_AUTHENTICATION, "simple");
            ldapEnv.put(Context.SECURITY_PRINCIPAL, sNomAdmin);
            ldapEnv.put(Context.SECURITY_CREDENTIALS, sSenhaAdmin);
            ldapEnv.put(Context.SECURITY_PROTOCOL, "simple");

            // Conecta no AD
            ctx = new InitialLdapContext(ldapEnv, null);
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.