Java Reference
In-Depth Information
using a message digest algorithm. For example, in the mysqlLogin module, you
should add the following highlighted options at the bottom:
<login-module code="Database" flag="required">
<module-option name="dsJndiName"
value="java:jboss/datasources/
jbossas7development"/>
<module-option name="principalsQuery"
value="select passwd from USERS where login=?"/>
<module-option name="rolesQuery"
value="select role, 'Roles' from USER_ROLES
where login=?"/>
<module-option name="hashAlgorithm"
value="MD5"/>
<module-option name="hashEncoding"
value="BASE64"/>
<module-option name="hashStorePassword"
value="true"/>
</login-module>
Here we have specified that the password will be hashed against an MD5 hash al-
gorithm; you can alternatively use any other algorithm allowed by your JCA provider,
such as SHA.
Note
For an excellent introduction to hashing algorithms, refer to the following link:
http://www.unixwiz.net/techtips/iguide-crypto-hashes.html
For the sake of completeness, we include here a small application, which uses the
java.security.MessageDigest and org.jboss.security.Base64Utils
class (contained in the picketbox-4.0.7.Final.jar file that is part of the JBoss
AS 7 modules), to generate the Base-64 hashed password that is to be inserted in
Database :
Search WWH ::




Custom Search