Java Reference
In-Depth Information
For the sake of completeness, we include a small application as follows, which generates
the Base64 hashed password that is to be inserted in Database :
public class Hash {
public static void main(String[] args) throws Exception{
String password = args[0];
MessageDigest md =
MessageDigest.getInstance("SHA-256");
byte[] passwordBytes = password.getBytes();
byte[] hash = md.digest(passwordBytes);
String passwordHash =
Base64.getEncoder().encodeToString(hash);
System.out.println("password hash: "+passwordHash);
}
Running the main program with admin as the argument will generate the hash
jGl25bVBBBW96Qi9Te4V37Fnqchz/Eu4qB9vKrRIqRg= . This hash will be your
updated password, which needs to be updated in your database, as shown in the following
screenshot. Update the password using the following code:
UPDATE USERS SET PASSWD = 'jGl25bVBBBW96Qi9Te4V37Fnqchz/
Eu4qB9vKrRIqRg=' WHERE LOGIN = 'admin';
You can update it with any SQL client of your choice.
Using the Database login module in your application
Once you are done with the login module configuration, don't forget to reference it
through the JBoss web deployment's descriptor, WEB-INF/jboss-web.xml :
Search WWH ::




Custom Search