JNDI将用户添加到组与ADS [英] JNDI Add Users to Groups with ADS
问题描述
我们一直在努力将用户添加到使用JNDI组。我们的目录服务器是Windows 2003 Active Directory中。
We have been trying to add users to groups using JNDI. Our directory server is Active Directory on Windows 2003.
我们能够创建用户和组就好了。然而,在作出任何组的这些用户的部分是一个问题。这是什么code样子(灵感来自这个):
We were able to create users and groups just fine. However, making these users part of any group is a problem. Here is what the code looks like (inspired by this):
ModificationItem mod[] = new ModificationItem[1];
mod[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE,
new BasicAttribute("member", "CN=User1,OU=LocationOfUser"));
localcontext.modifyAttributes("CN=Group1,ou=Group,ou=LocationOfTheGroup", mod);
我们得到这个错误回:
javax.naming.NameNotFoundException: [LDAP: error code 32 - 00000525:
NameErr: DSID- 031A0F80, problem 2001 (NO_OBJECT), data 0, best match of: ''
我们已经尝试绑定到一个子根(而不是给予充分的DN的属性)或绑定到根(并给予完整DN中的属性)。
We have tried to bind to a subroot (and not give the full DN in the attributes) or binding to the root (and giving the full DN in the attributes).
编辑:我们试图在同一code,但在用户CN用户( CN = ABCD,CN =用户
),和它的作品! !但是怎么来的也不会允许它的用户以外的?
We tried the same code, but with a user in the Users CN (CN=abcd,CN=Users
), and it works!!! But how come it won't allow it for users outside of that?
推荐答案
该错误说NO_OBJECT。错误code 32 LDAP_NO_SUCH_OBJECT。所以,问题是标识符之一是错误的。你可以列出的用户或组与指定的标识符?
The error says "NO_OBJECT". Error code 32 is LDAP_NO_SUCH_OBJECT. So the problem is that one of the identifiers is wrong. Can you list the user or group with the specified identifier?
【编辑】该错误消息说的最佳匹配:''
,这意味着它不能匹配任何部分的路径(在DN),甚至没有第一元件。我猜你必须使用完整路径的情况下(从根开始),而不是一个RDN。
The error message says best match of: ''
which means it can't match any part of the path (the DN), not even the first element. I guess you must use the full path in your case (starting from the root) instead of a RDN.
我也没有解释为什么你可以找到直接查询的对象,虽然。一定有什么不同,但除非你发布的所有code,这大约相当于我可以提供帮助。
I have no explanation why you can find the objects with direct queries, though. There must be something different but unless you post all the code, that's about as much as I can help.
这篇关于JNDI将用户添加到组与ADS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!