我在使用JNDI向LDAP验证域用户帐户(user01)时出错。虽然从技术上讲不是错误,但它是这样写的:
Username user01 does NOT have role Domain Users我认为和我的理解是,AD组(登录到应用程序的用户所在的位置)可以映射到web.xml代码中的角色名称,以允许用户登录到应用程序。
我当前的JNDI领域配置如下:
../tomcat7/conf/server.xml
<Realm className="org.apache.catalina.realm.JNDIRealm"
debug="99"
connectionURL="ldap://example.com:389"
authentication="simple"
referrals="follow"
connectionName="cn=administrator,cn=users,dc=example,dc=com"
connectionPassword="xxxxxxxxxx"
userSearch="(sAMAccountName={0})"
userBase="dc=example,dc=com"
userSubtree="true"
userRoleName="memberOf"
roleSearch="(member={0})"
roleName="cn"
roleSubtree="true"
roleBase="dc=example,dc=com" />../tomcat7/webapps/appdir/WEB-INF/web.xml (在此,我已尝试指定'role-name‘约束下的AD域'Users group’):
<security-constraint>
<display-name>Domain User Access</display-name>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Domain Users</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<description>Webapp Admins</description>
<role-name>Domain Admins</role-name>
</security-role>
<security-role>
<description>Webapp Users</description>
<role-name>Domain Users</role-name>
</security-role>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Entire Application</realm-name>
</login-config>
</web-app>../tomcat7/logs/catalina.out (尾随最后10行,它捕获了问题的原因-我认为-但我不知道如何纠正它)
Oct 10, 2018 4:53:55 PM org.apache.catalina.authenticator.AuthenticatorBase
register
FINE: Authenticated 'leeb' with type 'BASIC'
Oct 10, 2018 4:53:55 PM org.apache.catalina.authenticator.AuthenticatorBase
invoke
FINE: Calling accessControl()
Oct 10, 2018 4:53:55 PM org.apache.catalina.realm.RealmBase
hasResourcePermission
FINE: Checking roles GenericPrincipal[user01(CN=Domain
Admins,CN=Users,DC=example,DC=com,Domain Admins,)]
Oct 10, 2018 4:53:55 PM org.apache.catalina.realm.RealmBase hasRole
FINE: Username user01 does NOT have role Domain Users
Oct 10, 2018 4:53:55 PM org.apache.catalina.realm.RealmBase
hasResourcePermission
FINE: No role found: Domain Users
Oct 10, 2018 4:53:55 PM org.apache.catalina.authenticator.AuthenticatorBase
invoke
FINE: Failed accessControl() test有人能提供任何建议或指出一个明显的错误吗?我需要另一双眼睛来查看此配置的缺失之处。
发布于 2018-10-13 01:13:29
域用户是一个内置的功能,它报告域中的所有用户都属于这个组...但通过LDAP进行查询时除外。如果您使用LDAP浏览器查看对象,则它没有“成员”属性。类似地,LDAP查询"(&(memberOf=CN=Domain Users,CN=Users,DC=domain,DC=ccTLD))“不返回任何用户。
在我的域中,我创建了一个"All Users“组,它是作为新用户创建过程的一部分添加的--当用户创建是算法时还不错,但对于手动配置来说肯定不是很理想。我们将这个真实的组用于希望所有用户都具有某种基本级别访问权限的LDAP应用程序。
在传统组将所有帐户都填充为成员是不可能的情况下,您可以使用ADAM在AD前创建代理对象,例如,包含用户(&(primaryGroupID=513)) {主要组为域用户的用户}或(&(objectCategory=person))。不过,我不确定您是否可以在AD LDS (它取代了ADAM)中做同样的事情,因为我几年前就开始使用real AD组了。
https://stackoverflow.com/questions/52745569
复制相似问题