如何在 LDAP 中使用身份验证设置 Tomcat? [英] How do I set up Tomcat with authentication in LDAP?

查看:40
本文介绍了如何在 LDAP 中使用身份验证设置 Tomcat?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

"如何在 Tomcat 中通过自定义使用 LDAP 进行身份验证授权"

"How to use LDAP for authentication in Tomcat with Custom Authorization"

通过 Tomcat 中的 web.xml 进行 LDAP 身份验证"

"LDAP authentication via web.xml in Tomcat"

LDAP 身份验证要求及其操作方法"

"LDAP Authentication Requirements and How to do it"

我似乎不是唯一一个在这个问题上苦苦挣扎的人.使用当前配置,我可以使用我的 LDAP 用户而不是系统或 tomcat 用户进行身份验证.问题是每当我登录时,我都会被拒绝访问我应该看到的文件.

I seem to not be the only one struggling with this issue. With the current configuration, I can authenticate with my LDAP users and not with system or tomcat users. The problem is that whenever I'm logged in, I'm denied access to the files I should see.

我目前有一个包含以下信息的 web.xml

I currently have a web.xml with the following info

<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,内容如下

and a server.xml with the following content

<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 用户登录而不访问文件.

I have tried to find documentation around the net, but I'm simply stuck. So far, I've managed to access it without LDAP users, or log in with LDAP users and not access the files.

任何帮助将不胜感激.

推荐答案

如果我理解正确,您可以通过 LDAP 进行身份验证,但授权部分无法按预期工作.根据您提供的信息,您缺少角色和组之间的映射.您可以在这里

If I understand it correctly, you can authenticate via LDAP but the authorization piece is not working as expected. Based on the information you have provided, you are missing the mapping between your roles and your groups. You can find the instructions here

这篇关于如何在 LDAP 中使用身份验证设置 Tomcat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆