java – 从用户的多个OU递归地查询LDAP角色
我在具有自定义登录领域的WildFly 9.0.2服务器上运行Web应用程序(需要递归地查询在独立的配置中为用户组织单位C查询的组织单位B的组织单位). xml喜欢这样:
<security-realm name="LoginRealm"> <authentication> <ldap connection="EC2" base-dn="ou=users,dc=test,dc=de"> <username-filter attribute="uid"/> </ldap> </authentication> </security-realm> ... <security-domain name="other" cache-type="default"> <authentication> <login-module code="de.test.LoginModule" flag="required"> <module-option name="principalDNPrefix" value="uid="/> <module-option name="principalDNSuffix" value=",ou=users,dc=de"/> <module-option name="rolesCtxDN" value="ou=groups,dc=de"/> <module-option name="roleAttributeID" value="cn"/> <module-option name="roleAttributeIsDN" value="false"/> ... 用户通过提供他的用户名(例如testA),密码(例如任何)以及从下拉菜单(例如UserGroupA)中选择用户组来登录网站. <security-constraint> <display-name>Test-Service</display-name> <web-resource-collection> <web-resource-name>Test</web-resource-name> <url-pattern>/admin/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <description>Only Project Processors may see this</description> <role-name>Project Processor</role-name> </auth-constraint> </security-constraint> 现在,组织单位“ProjectControlCenter”被添加到LDAP树结构中,如下所示: dc=test,dc=de |-- ou=applications | |-- ou=ProjectControlCenter | | |-- ou=permissions | | | |-- cn=group.Project Processor.manage | | | |-- cn=group.Project Processor.read | | | |-- cn=group.Project Monitorer.read | | | |-- ... | | |-- ou=resources | | | |-- cn=ProjectControlCenter.Applicaton | | | |-- cn=ProjectControlCenter.List | | | |-- cn=ProjectControlCenter.System | | | |-- ... |-- ou=groups | | |-- cn=Project Processor | | |-- cn=Project Monitorer | | |-- ... | |-- ou=users | | |-- ou=UserGroupA | | | |-- uid=testA | | | |-- uid=testB | | | |-- uid=testC | | |-- ou=UserGroupB | | |-- ... 现在我不仅需要查询角色为ou = groups,dc = de,还可以查询所有ou = permissions,ou = ProjectControlCenter,ou = applications,dc =一个独特的成员,并添加到用户. 所以问题是:有没有办法递归查询特定用户的所有组,通过LDAP配置为这些组和资源的权限进行递归查询,还是需要重载createLdapInitContext(String username,Object credential)方法LdapLoginModule.class来实现所需的查询? 解决方法
它可能只是在一定程度上.您的用例似乎相当复杂,我个人将避免这种设计.不知道你是否已经检查过,但您的问题似乎与
here有关.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |