Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7433381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:39:39+00:00 2026-05-29T09:39:39+00:00

I am toying with tomcat security for servlets. In my server.xml I have <Realm

  • 0

I am toying with tomcat security for servlets. In my server.xml I have

<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
 resourceName="UserDatabase" 
 digest="SHA"/>

and in my tomcat-users.xml

<user username="zenon" password="qazxsw" roles="proby"/>
<user username="andrzej" password="1c29cf0ceb89afce131e27b76c18af1e9cf7f5e3" roles="admin-gui,manager-gui,proby,role1"/>

web.xml of very simple application

<security-constraint>
  <display-name>No Pasaran</display-name>
  <web-resource-collection>
    <web-resource-name>Tylko dla memberow</web-resource-name>
    <url-pattern>/*</url-pattern>
  </web-resource-collection>
  <auth-constraint>
    <role-name>proby</role-name>
    <role-name>role1</role-name>
  </auth-constraint>
</security-constraint>
<login-config>
  <auth-method>BASIC</auth-method>
  <realm-name>UserDatabase</realm-name>
</login-config>

so when auth-method is BASIC I can log in with username:andrzej and password:qazxsw (this long password of andrzej is SHA of qazxsw) so it seems that now when I send password he already is digesting it before comparing.
I think so because when i use DIGEST as auth-method I can’t log in, is he digesting password twice before comparing it?
If yes is there any other way then https to secure such things on container level?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:39:40+00:00Added an answer on May 29, 2026 at 9:39 am

    First of all HTTP DIGEST doesn’t use SHA, it uses MD5, unfortunately. You will need to replace SHA with MD5 in both your Realm defined in server.xml and in the command line you use to generate password digests.

    Then, as Tomcat documentation suggests in case your realm passwords are digested the ways to generate passwords for BASIC and DIGEST auth mechanisms are different. So you can’t possibly use the same password digest to test both BASIC and DIGEST methods.

    In case of BASIC you generate password digest with this:

    CATALINA_HOME/bin/digest.[bat|sh] -a {algorithm} {cleartext-password}
    

    and in case of DIGEST it is:

    CATALINA_HOME/bin/digest.[bat|sh] -a {algorithm} {username}:{realm}:{cleartext-password}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement JDBCRealm in tomcat (as described in http://tomcat.apache.org/tomcat-4.1-doc/realm-howto.html#Configuring%20a%20Realm ) to check
I am trying to access an XML file from JSP on my Tomcat server.
I'm trying to setup josso on an apache tomcat server running on windows. I've
i have a Swing-client and a Server running on tomcat 7, which communicate with
I have remote logged into my machine and trying to start tomcat server. But,
I'm trying to configure a Tomcat server with SSL. I've generated a keypair thus:
I'm trying to create a self signed certificate for use with Apache Tomcat 6.
I have been trying to install tomcat-6.0.26 on my Mac OS 10.6. I followed
i am trying to increase tomcat memory by adding JAVA_OPTS in catalina.bat as follows:
I am trying to implement security for the following architecture: Web tier: Tomcat 7

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.