我正在设置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 manager / status页面的权限。我怎样才能做到这一点?我试图将经理的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的日志文件中也没有任何错误。
答案 0 :(得分:2)
在LDAP中将roleName更改为正确的角色名称值,并且在重新启动tomcat服务后,它正常工作。
答案 1 :(得分:1)
不是Tomcat 8,但这个想法仍然是一样的。