0

I've my tomcat-users.xml defined this way on Windows 11, tomcat version 9.0.78:

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<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">
<!--
  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.

  Built-in Tomcat manager roles:
    - manager-gui    - allows access to the HTML GUI and the status pages
    - manager-script - allows access to the HTTP API and the status pages
    - manager-jmx    - allows access to the JMX proxy and the status pages
    - manager-status - allows access to the status pages only

  The users below are wrapped in a comment and are therefore ignored. If you
  wish to configure one or more of these users for use with the manager web
  application, do not forget to remove the <!.. ..> that surrounds them. You
  will also need to set the passwords to something appropriate.
-->
<!--
  <user username="admin" password="<must-be-changed>" roles="manager-gui"/>
  <user username="robot" password="<must-be-changed>" roles="manager-script"/>
-->
<!--
  The sample user and role entries below are intended for use with the
  examples web application. They are wrapped in a comment and thus are ignored
  when reading this file. If you wish to configure these users for use with the
  examples web application, do not forget to remove the <!.. ..> that surrounds
  them. You will also need to set the passwords to something appropriate.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
  <user username="role1" password="<must-be-changed>" roles="role1"/>
-->
<role rolename="tomcat"/>
  <role rolename="manager-gui"/>
  <role rolename="admin-gui"/>
  <user username="jack" password="4f60ef32b9f4cf8a30d85167c9575e627d1f03845575a620ff5654b85eb29add$1$15a54860775edfab43b7010aed9ca814c6647f5b1c07253cbcdac7dc80e07833ee9ae5392aac0b7ba96760100a1462dcc51ed91cb8c4768bba1de77193f0ad57" roles="tomcat,manager-gui,admin-gui"/>
  <user username="TomcatJackAdmin" password="test" roles="manager-gui"/>
</tomcat-users>

And I've generated the hash like this from my bin directory :

bin>.\digest.bat -a SHA-512 -h org.apache.catalina.realm.MessageDigestCredentialHandler password

When I login to Tomcat Manager (tomcat 9.0.78) on Windows using TomcatJackAdmin and test, it works fine. But I'm trying to use the encrypted stuff, username- jack and the password for which hash exists above. It doesn't work. Are there an additional steps I need to fix the above issue?

Tan
  • 1,433
  • 5
  • 27
  • 47
  • Does this answer your question? [How to use digest authentication in Tomcat 8.5?](https://stackoverflow.com/questions/39967289/how-to-use-digest-authentication-in-tomcat-8-5) – Olaf Kock Aug 02 '23 at 08:58
  • That doesn't. I looked at it before asking. They are also suggesting to make changes in `web.xml` but for one user, I have this thing working without any changes in `web.xml` so that's confusing. Also, it's not very clear how to test the web.xml part in the answer. – Tan Aug 02 '23 at 15:09

0 Answers0