I'm trying to setup digested authentication on Tomcat 8.5 on CentOS 7. I've looked/followed various articles including - How to use digest authentication in Tomcat 8.5? - but after following all the required steps it's not working. I've set this up for the manager and host-manager apps but the password is never excepted and the localhost_access log reports a 401 error. Access to these apps was working using Basic authentication.
My server.xml is configured as so:
<!-- 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 for each app has been edited as so:
<!-- Define the Login Configuration for this Application -->
<login-config>
<auth-method>DIGEST</auth-method>
<realm-name>UserDatabase</realm-name>
</login-config>
The password was created by:
/opt/tomcat/bin/digest.sh -s 0 -a sha-256 -h org.apache.catalina.realm.MessageDigestCredentialHandler "username":UserDatabase:"password"
The password in tomcat-user.xml has been replaced with this.
I've also checked in server.xml that the "name" in following section matches that as defined in the lockoutrealm section of server.xml and web.xml
<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"/>
I've also restarted the tomcat service after these changes, I evn restarted the server - clutching at straws.....
When I try and log through a browser I keep getting re-prompted as below, if I cancel I get the standard 401 error screen
I know I must have missed something but I've been at this for a while now and just can't see what it is.