Related to topic Adding Users during Plattform Server Startup, I wrote a small tool to generate password for your user.
You can see in that topic you can config your user informations in xml file: username, first name, last name, email,… But how about password? It is encrypted. You can reuse password and salt in that xml file (password is admin), or you can use my tool to generate any password you want.
generatepassword.zip (352.5 KB)
How to use it?
- Download zip file above and extract it.
- Go to extracted folder and run
java -cp ".:./shiro-core-1.4.0.jar" GeneratePassword passwort cf41c880e9b55316c3b8ccb0e8aad01f
In this case passwort is your password and cf41c880e9b55316c3b8ccb0e8aad01f is your salt.
You will receive an output like that:
plainTextPassword: passwort
salt: cf41c880e9b55316c3b8ccb0e8aad01f
password: ddff2638b2583e6a937217b358b524f30b0b5e5be6122122cc199f2a804fe4db66b6ccb646db469e75c8f63ce54e8695284708473a168c76bb8c59764ccd20d7
Now you got encrypted password. Put encrypted password and salt to your xml file. Your user can login with password passwort.
FYI, here is my code:
import org.apache.shiro.codec.Hex;
import org.apache.shiro.crypto.hash.Sha512Hash;
import org.apache.shiro.util.ByteSource;
import org.apache.shiro.util.SimpleByteSource;
public class GeneratePassword {
public static void main(String[] args){
String plainTextPassword = args[0];
String salt = args[1];
final ByteSource saltByteSource = new SimpleByteSource(Hex.decode(salt));
String password = new Sha512Hash(plainTextPassword, saltByteSource, 200000).toHex();
System.out.println("plainTextPassword: " + plainTextPassword);
System.out.println("salt: " + salt);
System.out.println("password: " + password);
}
}