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 3984942
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:49:51+00:00 2026-05-20T05:49:51+00:00

writing a Java EE 6 application i need some help using the DatabaseServerLoginModule with

  • 0

writing a Java EE 6 application i need some help using the DatabaseServerLoginModule with md5 hashing.

Setup:

login-config.xml:

 <application-policy name = "app">
      <authentication>
      <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
        <module-option name = "dsJndiName">java:/MySQLDS</module-option>
        <module-option name = "principalsQuery">Select password from user where email_current=?</module-option>
        <module-option name="rolesQuery">
            SELECT r.name, 'Roles' FROM role r, user_2_role ur, user u WHERE
            u.email_current=? AND u.id_user=ur.id_user AND ur.id_role=r.id_role
        </module-option> 
        <module-option name ="hashAlgorithm">md5</module-option>
        <module-option name="hashEncoding">base64</module-option>
        <module-option name="ignorePasswordCase">false</module-option>
        <module-option name="hashStorePassword">false</module-option>
        <module-option name="hashUserPassword">true</module-option>
     </login-module>
     <!-- login-module code="org.jboss.security.ClientLoginModule" flag="required" /-->
     </authentication>
 </application-policy>

web.xml:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Customer Content</web-resource-name>
        <url-pattern>/customer/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>AuthorizedUser</role-name>
        <role-name>customer</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>
<login-config>
    <auth-method>DIGEST</auth-method>
    <realm-name>The Restricted Zone</realm-name>
    <form-login-config>
        <form-login-page>/login.html</form-login-page>
        <form-error-page>/login.html</form-error-page>
    </form-login-config>
</login-config>
<security-role>
    <description>The role required to access restricted content </description>
    <role-name>customer</role-name>
</security-role>

The login implementation(the important part):

// login
WebAuthentication pwl = new WebAuthentication();
if (pwl.login(aEmail, aPassword)) {
    return "customer/dashboard?faces-redirect=true";
} else {
    throw new IncorrectCredentialsException();
}

I store the passwords using the following implementation:

final byte[] md5Hash = DigestUtils.md5(newPassword);
md5NewPassword = Hex.encodeHexString(md5Hash);

I checked the value that was written into the database with some md5 generators from the internet like http://www.miraclesalad.com/webtools/md5.php

The write all the same.

Using the upon authentication method without md5 hashing at all and with form instead of digest configured works. Any idea?

Thanks in advance

  • 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-20T05:49:51+00:00Added an answer on May 20, 2026 at 5:49 am

    md5 hash is now recognized as non-safe. It was broken in many ways.

    Better use SHA.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a Java application using the Play framework and need some HTTP-Live streaming. I
I am writing application using PhoneGap on Android. I need to call some PhoneGap
I'm writing a Java GUI application that is doing some XML parsing and analysis.
I'm writing a Java application with GUI using Swing. One of the GUI components
So I'm writing a Java application that uses Simple to store data as xml
I am writing a java application that takes schema-bounded XML as input and needs
Using mysql 5.5.2 on windows (Wamp) I'm writing a Java application that use several
So i am writing my first Java application using MVP pattern. One of MVPs
I need to send email notifications in my Java web application. I'm using Apache
I'm writing a small demo application in Java using Spring, that needs to have

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.