This content has been marked as final.
Show 3 replies
-
1. Re: Custom Password encryption on authentication
askmahesh Feb 8, 2006 4:20 PM (in response to askmahesh)Ok... Since none replied to this post i had to figure out myself and got it working.
Here's what i did
- Created a Custom DatabaseLogonModule which extends jboss - DatabaseServerLoginModulepublic class DatabaseLogonModule extends DatabaseServerLoginModule { /** * @param username the username which is actually ignored * @param password the password from which to create the MD5 hash * @return the unmodified password * @see org.jboss.security.auth.spi.UsernamePasswordLoginModule#createPasswordHash(java.lang.String, java.lang.String) */ protected String createPasswordHash( String username, String password ) { return customEncryption(password); }
- create a custom-jboss.jar (or any name you want ) and place it in your webapp.sar folder
- Modify the login-config.xml<login-module code="path.to.your.custom.logon.module.DatabaseLogonModule" flag="required">
And Jboss will now authenticate with the encrypted password provided in the Custom Logon Module. -
2. Re: Custom Password encryption on authentication
vakuthota Nov 5, 2006 8:55 PM (in response to askmahesh)Hi,
I have the same requirement. I tried as you said. but it seems that it is not invoked. everytime user login failing.
I just did what you said..
I even enabled the trace logging, There it shows my custom login module is loaded. But it is failing.
Do i need do anything else to make it work ??
Appreciate your help. -
3. Re: Custom Password encryption on authentication
vakuthota Nov 6, 2006 5:27 PM (in response to askmahesh)Why do we have to write our own custom class, as per documentation it is supporting the hashalgorithm already.
if you mention the following options in login-config.xml<application-policy name="myapp"> <authentication> <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required"> <module-option name="dsJndiName">java:/ngirmDS</module-option> <module-option name="principalsQuery">Select PASSWORD from USERS where LOGINNAME =?</module-option> <module-option name="rolesQuery">Select GROUPNAME , 'Roles' from USERGRPASSOC where LOGINNAME =?</module-option> <module-option name="hashAlgorithm">SHA</module-option> <module-option name="hashEncoding">Base64</module-option> <module-option name="hashCharset">UTF-8</module-option> </login-module> </authentication> </application-policy>
But i tried this, it is not working.
Any idea ??