Package org.kawanfw.sql.api.server.auth
Class JdbcPasswordEncryptor
java.lang.Object
org.kawanfw.sql.api.server.auth.JdbcPasswordEncryptor
public class JdbcPasswordEncryptor extends Object
Tooling class that allows to generate to hashed/encrypted passwords for
The hash parameters (algorithm, iterations, salt) are defined in the
The
JdbcUserAuthenticator
. The encrypted passwords are to be inserted in
the users table. The hash parameters (algorithm, iterations, salt) are defined in the
aceql-sever.properties
. The
encryptPassword(String)
method may be called from a Java
program:
File file = new File("/path/to/aceql-server.properties");
String password = "myPassword";
JdbcPasswordEncryptor jdbcPasswordEncryptor = new JdbcPasswordEncryptor(file);
String encryptedPassword = jdbcPasswordEncryptor.encryptPassword(password);
System.out.println(encryptedPassword);
It may also be run as command line:
- Open a command line on Windows or Linux/Bash.
cd <installation-directory>/AceQL/bin
- Windows: run
jdbc_password_encryptor.bat -help
- Linux: run
jdbc_password_encryptor -help
- Since:
- 10.1
- Author:
- Nicolas de Pomereu
-
Constructor Summary
Constructors Constructor Description JdbcPasswordEncryptor(File propertiesFile)
Default constructor. -
Method Summary
Modifier and Type Method Description String
encryptPassword(String password)
Encrypts the password passed as parameter.static void
main(String[] args)
Allows to encrypt password for theJdbcUserAuthenticator
implementation.
-
Constructor Details
-
JdbcPasswordEncryptor
public JdbcPasswordEncryptor(File propertiesFile) throws DatabaseConfigurationException, IOExceptionDefault constructor.- Parameters:
propertiesFile
- the aceql-server.properties file- Throws:
IOException
- if an I/O Exception occursDatabaseConfigurationException
- if a configuration Exception occurs
-
-
Method Details
-
encryptPassword
Encrypts the password passed as parameter.- Parameters:
password
- the password to encrypt- Returns:
- the encrypted value of the password
-
main
public static void main(String[] args) throws org.apache.commons.cli.ParseException, DatabaseConfigurationException, IOExceptionAllows to encrypt password for theJdbcUserAuthenticator
implementation.
A call with the clear password as parameter will print the encrypted password.- Parameters:
args
- the arguments: pass "-help" to have arguments list.- Throws:
org.apache.commons.cli.ParseException
- if any Exception when parsing command lineIOException
- if any I/O ExceptionDatabaseConfigurationException
- if any error in configuration properties file
-