我正在设置 Tomcat 8.5 服务器以对 Tomcat 的管理器部分使用 LDAP 身份验证。到目前为止,我已使用正确的领域设置更改了 server.xml。
<Realm className="org.apache.catalina.realm.JNDIRealm"
debug="99"
connectionURL="ldap://ldap.server.com:389"
authentication="simple"
referrals="follow"
connectionName="CN=user,OU=Service,OU=Users,DC=server,DC=group,DC=mainserver,DC=com"
connectionPassword="password of the user"
userSearch="(sAMAccountName={0})"
userBase="DC=group,DC=mainserver,DC=com"
userSubtree="true"
roleSearch="(member={0})"
roleName="name of the ldap role"
roleSubtree="true"
roleBase="OU=Groups,DC=group,DC=mainserver,DC=com"/>
现在我想使用 LDAP 组来授予用户访问 tomcat 管理器/状态页面的权限。我怎样才能做到这一点?我尝试将管理器的 web.xml 更改为
<security-role>
<description>
The role that is required to access the HTML Manager pages
</description>
<role-name>LDAP group</role-name>
</security-role>
<security-role>
<description>
The role that is required to access the text Manager pages
</description>
<role-name>LDAP group</role-name>
</security-role>
<security-role>
<description>
The role that is required to access the HTML JMX Proxy
</description>
<role-name>LDAP group</role-name>
</security-role>
<security-role>
<description>
The role that is required to access to the Manager Status pages
</description>
<role-name>LDAP group</role-name>
</security-role>
但是没有用。现在可以使用用户登录,但是当我浏览到管理器页面时出现“403 访问被拒绝”错误。在 Tomcat 的日志文件中也没有任何错误。
最佳答案
将 roleName 更改为 LDAP 中的正确角色名称值,并且在重新启动 tomcat 服务后它工作得很好。
关于tomcat - 设置 Tomcat 以使用来自特定组的 LDAP 用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40083432/