Java Tomcat的LDAP身份验证-403错误
我想使用LDAP保护我的Tomcat服务器 首先,我在一个在线LDAP测试服务器上尝试它,它的详细信息存在于中 我的tomcat服务器将所有请求从端口8080重定向到端口8433,然后请求用户名和密码,然后(当我输入正确的数据时)返回403错误页面 有什么问题 server.xml中的相关部分:Java Tomcat的LDAP身份验证-403错误,java,tomcat,ldap,Java,Tomcat,Ldap,我想使用LDAP保护我的Tomcat服务器 首先,我在一个在线LDAP测试服务器上尝试它,它的详细信息存在于中 我的tomcat服务器将所有请求从端口8080重定向到端口8433,然后请求用户名和密码,然后(当我输入正确的数据时)返回403错误页面 有什么问题 server.xml中的相关部分: <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="o
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.JNDIRealm" debug="10"
connectionURL="ldap://ldap.forumsys.com:389"
alternateURL="ldaps://ldap.forumsys.com:636"
userBase="dc=example,dc=com"
userSearch="(uid={0})"
userSubtree="true"
userRoleName="l"
connectionName="cn=read-only-admin,dc=example,dc=com"
connectionPassword="password"
/>
</Realm>
web.xml中的相关部分:
<welcome-file-list>
<welcome-file>main.html</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>Authenticated area</web-resource-name>
<url-pattern>/main.html</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>HEAD</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>tomcat</role-name>
<role-name>Admin</role-name>
<role-name>Authenticated</role-name>
<role-name>mathematicians</role-name>
<role-name>gauss</role-name>
<role-name>galieleo</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<description>
This logical role includes all authenticated users
</description>
<role-name>tomcat</role-name>
<role-name>site-users</role-name>
<role-name>Authenticated</role-name>
<role-name>mathematicians</role-name>
<role-name>gauss</role-name>
<role-name>galieleo</role-name>
</security-role>
</web-app>
main.html
认证区域
/main.html
删除
得到
头
邮递
放
雄猫
管理
认证
数学家
高斯
加利埃略
基本的
此逻辑角色包括所有经过身份验证的用户
雄猫
网站用户
认证
数学家
高斯
加利埃略
tomcat-users.xml中的相关部分:
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="mathematicians"/>
<role rolename="site-users"/>
<role rolename="tomcat"/>
<user username="gauss" roles="site-users,user,tomcat" />
</tomcat-users>
我使用用户名“gauss”和密码“password”什么是userRoleName=“l”这应该是LDAP中用户条目的l=locale属性,并且这些值必须是
<role-name>tomcat</role-name>
<role-name>site-users</role-name>
<role-name>Authenticated</role-name>
<role-name>mathematicians</role-name>
<role-name>gauss</role-name>
<role-name>galieleo</role-name>
tomcat
网站用户
认证
数学家
高斯
加利埃略
如果您想要任何经过身份验证的用户,只需执行以下操作:
<role-name>*</role-name>
*
看看是否有帮助……在我写问题之前,我看到了这个线索。但是我没有发现任何可以帮助我的响应。如果您使用LDAP身份验证,那么您的
tomcat users.xml
文件是完全不相关的。您可以使用什么LDAP搜索字符串来成功提取任意用户的角色,例如“gauss”?用户角色名真的是l
?我写了所有细节。我在Wireshark中看到Ldap服务器的良好响应