我試圖在CentOS 7上的Tomcat 8.5上設置消化認證。我看過/關注了包括 - How to use digest authentication in Tomcat 8.5?在內的各種文章 - 但是在遵循所有必需的步驟之後,它不起作用。我已經爲經理和主機管理員應用程序設置了這一點,但密碼從不例外,localhost_access日誌報告401錯誤。訪問這些應用程序正在使用基本身份驗證。Tomcat 8.5消化認證
我的server.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"
<!-- 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中爲每個應用已被編輯爲這樣
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服務後這些變化,我evn重新啓動服務器 - 抓住吸管.....
當我嘗試通過瀏覽器登錄時,我不斷收到重新提示如下,如果我取消我得到標準的401錯誤屏幕
我知道我一定錯過了一些東西,但我已經在這一段時間了,只是看不到它是什麼。
非常感謝,它完美的作品!適用於服務器運行的Web應用程序。 – OPW