【发布时间】:2017-08-03 09:06:50
【问题描述】:
我正在尝试在 CentOS 7 上的 Tomcat 8.5 上设置摘要式身份验证。我查看/关注了各种文章,包括 - How to use digest authentication in Tomcat 8.5? - 但在执行了所有必需的步骤后,它不起作用。我已经为管理器和主机管理器应用程序设置了这个,但密码永远不会例外,并且 localhost_access 日志报告 401 错误。使用基本身份验证可以访问这些应用程序。
我的 server.xml 是这样配置的:
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase">
<CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="SHA-256" />
</Realm>
</Realm>
每个应用程序的 web.xml 已被编辑为:
<!-- Define the Login Configuration for this Application -->
<login-config>
<auth-method>DIGEST</auth-method>
<realm-name>UserDatabase</realm-name>
</login-config>
密码创建者:
/opt/tomcat/bin/digest.sh -s 0 -a sha-256 -h org.apache.catalina.realm.MessageDigestCredentialHandler "username":UserDatabase:"password"
tomcat-user.xml 中的密码已经换成这个了。
我还在 server.xml 中检查了以下部分中的“名称”是否与 server.xml 和 web.xml 的 lockoutrealm 部分中定义的匹配
<Resource
auth="Container"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
name="UserDatabase" #<--------------NOTE
pathname="conf/tomcat-users.xml"
type="org.apache.catalina.UserDatabase"/>
在进行这些更改后,我还重新启动了 tomcat 服务,我什至重新启动了服务器 - 抓着稻草.....
当我尝试通过浏览器登录时,我不断收到如下提示,如果我取消,我会看到标准的 401 错误屏幕
我知道我一定错过了什么,但我已经做了一段时间了,只是看不到它是什么。
【问题讨论】:
标签: tomcat authentication