0

我正在尝试允许 Active Directory 中嵌套组的用户登录到我的基于 spring boot/security 的应用程序。我已经想出了如何通过 spring-security 配置提供搜索查询,但是搜索查询本身有问题。

这是当前按预期工作的搜索查询:

(&(objectCategory=Person)(userPrincipalName=user1@domain.local)
  (memberOf:1.2.840.113556.1.4.1941:=CN=parent_group1,OU=Another Group,OU=Groups,OU=Company,DC=Company-Domain,DC=local))

这按预期工作,因为 user1 属于 parent_group1 或其子组之一。但我有不止一个 parent_group,前缀不变。所以我试图在该查询中提供通配符CN=parent_group*,但它不起作用。

在这里看到了一个变体,其中每个 parent_group 都可以添加一个 OR,如下所示:

(&(objectCategory=Person)(userPrincipalName=user1@domain.local)
   (|(memberOf:1.2.840.113556.1.4.1941:=CN=parent_group1,OU=Another Group,OU=Groups,OU=Company,DC=Company-Domain,DC=local)
     (memberOf:1.2.840.113556.1.4.1941:=CN=parent_group2,OU=Another Group,OU=Groups,OU=Company,DC=Company-Domain,DC=local)
     (memberOf:1.2.840.113556.1.4.1941:=CN=parent_group3,OU=Another Group,OU=Groups,OU=Company,DC=Company-Domain,DC=local)

这也有效。但问题是,每次添加新的父组时,都需要更新。我已经浏览了上述问题的答案中指定的链接,但那里没有任何效果。

理想情况下,我希望这样的事情会起作用(parent_group 的通配符模式):

(&(objectCategory=Person)(userPrincipalName=user1@domain.local)
  (memberOf:1.2.840.113556.1.4.1941:=CN=parent_group*,OU=Another Group,OU=Groups,OU=Company,DC=Company-Domain,DC=local))

但它不起作用。它不返回任何结果。如果有更好的方法可以帮助我吗?

另外,这样的整个层次结构可以不提吗? CN=parent_group*,OU=Another Group,OU=Groups,OU=Company,DC=Company-Domain,DC=local

我已经对此进行了几天的研究,并浏览了在线或 SO 上提供的大部分文章,但到目前为止,使用链式命令的通配符模式没有任何效果。

4

1 回答 1

0

不可能按照您的描述进行。拥有一个所有“其他”父组都嵌套在其中的父组会为您提供很好的服务。无论何时创建新的父组,您都可以将其嵌套在您的主组中,以便获得访问权限。这是一个很常见的模型。

于 2018-08-16T23:04:54.603 回答