使用Java将电话添加到AD中的用户帐户

时间:2019-03-13 12:31:14

标签: java ldap

使用Java,我需要向AD中的用户添加电话号码。

        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");

        // Connect AD
        ctx = new InitialLdapContext(ldapEnv, null);

现在我该怎么做才能向用户添加电话号码?

0 个答案:

没有答案