Active directory 什么;域名“;我应该在JNDI登录到Active Directory服务器时指定吗?

Active directory 什么;域名“;我应该在JNDI登录到Active Directory服务器时指定吗?,active-directory,ldap,jndi,principal,Active Directory,Ldap,Jndi,Principal,我想知道我应该指定什么“主体”来登录Active Directory服务器。负责人是否应该是我尝试登录的广告中的用户?或者它可以是我指定的域中的用户,只要该用户具有访问该广告的权限 我尝试了这两种方法,但都出现了错误49。但我可以使用安装广告的服务器的管理员帐户,使用ldp.exe登录广告 这是我的密码。非常感谢您的及时帮助 Hashtable env= new Hashtable(11); env.put(Context.SECURITY_AUTHENTICATION,"simple"); /

我想知道我应该指定什么“主体”来登录Active Directory服务器。负责人是否应该是我尝试登录的广告中的用户?或者它可以是我指定的域中的用户,只要该用户具有访问该广告的权限

我尝试了这两种方法,但都出现了错误49。但我可以使用安装广告的服务器的管理员帐户,使用ldp.exe登录广告

这是我的密码。非常感谢您的及时帮助

Hashtable env= new Hashtable(11);
env.put(Context.SECURITY_AUTHENTICATION,"simple"); // Also tried none w/ the same error

// What principal should I use??
env.put(Context.SECURITY_PRINCIPAL,"CN=Ross,OU=Eng,DC=RossInc");//User
//env.put(Context.SECURITY_PRINCIPAL, user + "@" + domain); // Tried w/ the same error

env.put(Context.SECURITY_CREDENTIALS, "ross");//Password
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL,"ldap://myserver:389/DC=RossInc");

DirContext ctx = new InitialDirContext(env); <-- Fails with AuthenticationException: [LDAP: error code 49 - 8009030C
Hashtable env=新的Hashtable(11);
env.put(Context.SECURITY_身份验证,“simple”);//也尝试了无,但出现了相同的错误
//我应该使用什么原则??
环境保护(Context.SECURITY_PRINCIPAL,“CN=Ross,OU=Eng,DC=RossInc”)//使用者
//环境put(Context.SECURITY_主体,用户+“@”+域);//尝试了相同的错误
环境保护(Context.SECURITY_凭证,“ross”)//密码
put(Context.INITIAL\u Context\u工厂,“com.sun.jndi.ldap.LdapCtxFactory”);
env.put(Context.PROVIDER\u URL,“ldap://myserver:389/DC=RossInc");
DirContext ctx=新的初始DirContext(env) 根据来自Oracle站点的消息,安全主体是一个可分辨名称

以下是一些在域内的计算机上为我工作的代码:

Hashtable<String, String> ldapEnv = new Hashtable<String, String>(11);
ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
ldapEnv.put(Context.PROVIDER_URL,  "ldap://societe.fr:389");
ldapEnv.put(Context.SECURITY_AUTHENTICATION, "simple");
ldapEnv.put(Context.SECURITY_PRINCIPAL, "cn=administrateur,cn=users,dc=societe,dc=fr");
ldapEnv.put(Context.SECURITY_CREDENTIALS, "test.2011");
ldapContext = new InitialDirContext(ldapEnv);
Hashtable ldapEnv=新的Hashtable(11);
ldapEnv.put(Context.INITIAL_Context_工厂,“com.sun.jndi.ldap.LdapCtxFactory”);
ldapEnv.put(Context.PROVIDER\u URL,“ldap://societe.fr:389");
ldapEnv.put(Context.SECURITY_身份验证,“simple”);
ldapEnv.put(Context.SECURITY_PRINCIPAL,“cn=administrator,cn=users,dc=societe,dc=fr”);
ldapEnv.put(Context.SECURITY_凭证,“test.2011”);
ldapContext=新的初始目录上下文(ldapEnv);

主体可以是广告中的用户,只要他有访问广告的权限。

您可以提供:

  • NT样式登录名
  • Kerberos UPN(隐式UPN)
  • 显式UPN(如果定义了其他UPN足够)

更重要的是,永远不要执行简单的绑定!无论是摘要还是GSS-API。

我在AD和代码中设置了“主体”。然后我用它登录,仍然得到相同的错误!此示例仅适用于其他目录服务。请再次使用正确的英语。