"How to use LDAP for authentication in Tomcat with Custom Authorization"
"LDAP authentication via web.xml in Tomcat"
"LDAP Authentication Requirements and How to do it"
似乎不止我一个人在为这个问题苦苦挣扎。 使用当前配置,我可以通过我的 LDAP 用户进行身份验证,而不能通过系统或 tomcat 用户进行身份验证。问题是每当我登录时,我都被拒绝访问我应该看到的文件。
我目前有一个包含以下信息的 web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>Nrt</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Home</realm-name>
</login-config>
和一个包含以下内容的 server.xml
<Realm className="org.apache.catalina.realm.JNDIRealm"
connectionURL="ldap://192.168.75.146:389"
userPattern="uid={0},ou=people,dc=localhost,dc=localdomain"
roleBase="cn=admin,ou=group,dc=localhost,dc=localdomain"
roleName="cn"
roleSearch="memberUid={1}"
debug="99"/>
我试图在网上查找文档,但我只是被卡住了。到目前为止,我已经设法在没有 LDAP 用户的情况下访问它,或者使用 LDAP 用户登录但无法访问文件。
如有任何帮助,我们将不胜感激。
最佳答案
如果我理解正确,您可以通过 LDAP 进行身份验证,但授权部分没有按预期工作。根据您提供的信息,您缺少角色和组之间的映射。您可以找到说明 here
关于tomcat - 如何在 LDAP 中使用身份验证设置 Tomcat?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10192981/