设置Tomcat以使用特定组中的LDAP用户

设置Tomcat以使用特定组中的LDAP用户,tomcat,authentication,ldap,Tomcat,Authentication,Ldap,我正在设置一个Tomcat 8.5服务器,以便对Tomcat的manager部分使用LDAP身份验证。到目前为止,我已经用正确的领域设置更改了server.xml <Realm className="org.apache.catalina.realm.JNDIRealm" debug="99" connectionURL="ldap://ldap.server.com:389" auth

我正在设置一个Tomcat 8.5服务器,以便对Tomcat的manager部分使用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>

访问HTML管理器页面所需的角色
LDAP组
访问文本管理器页面所需的角色
LDAP组
访问HTML JMX代理所需的角色
LDAP组
访问管理器状态页所需的角色
LDAP组

但是没有起作用。现在可以使用用户登录,但我在浏览管理器页面时遇到“403拒绝访问”错误。Tomcat的日志文件中也没有任何错误。

在LDAP中将roleName更改为正确的角色名称值,并且在重新启动Tomcat服务后,它工作正常。

不是Tomcat 8,但想法仍然相同

这可能有助于: