Skip to content

Commit 62b322f

Browse files
authored
fix(jans-orm): use password.method prefix for all hash algs (#11502)
Signed-off-by: yurem <[email protected]>
1 parent 28e5d54 commit 62b322f

File tree

5 files changed

+35
-35
lines changed

5 files changed

+35
-35
lines changed

docs/janssen-server/config-guide/hash-password.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,41 @@
22
tags:
33
- administration
44
- developer
5-
- confiration
5+
- configuration
66
- Hashed Passwords
77
- Entry manager
88
---
99

1010
## Hashed Passwords
1111

12-
ORM stores users password in DB in hasing form. It supports next hash methods: SHA, SSHA, SHA-256, SSHA-256, SHA-384, SSHA-384, SHA-512, SSHA-512 MD5, SMD5, CRYPT, CRYPT-MD5, CRYPT-SHA-256, CRYPT-SHA-512, CRYPT-BCRYPT $2a$, CRYPT-BCRYPT $2b$, PKCS5S2, ARGON2
12+
ORM stores users password in DB in hashing form. It supports next hash methods: SHA, SSHA, SHA-256, SSHA-256, SHA-384, SSHA-384, SHA-512, SSHA-512 MD5, SMD5, CRYPT, CRYPT-MD5, CRYPT-SHA-256, CRYPT-SHA-512, CRYPT-BCRYPT $2a$, CRYPT-BCRYPT $2b$, PKCS5S2, ARGON2
1313

1414
Support additional hashing methods can be added with [Persistence Extension](../../script-catalog/persistence_extension/persistence/#persistence-script) script.
1515

16-
# Hash Passowrd properties
16+
# Hash Password properties
1717

1818
New hash methods like Argon2 supports default hash properties override. This is supported list of properties from `/etc/jans/conf/jans-sql.properties`:
1919

2020
```
2121
# Argon 2 parameters
2222
# 0 - ARGON2_d, 1 - ARGON2_i, 2 - ARGON2_id
23-
pasword.method.argon2.type=2
23+
password.method.argon2.type=2
2424
# 1.0 - 16, 1.3 - 19
25-
pasword.method.argon2.version=19
26-
pasword.method.argon2.salt-length=16
27-
pasword.method.argon2.memory=7168
28-
pasword.method.argon2.iterations=5
29-
pasword.method.argon2.parallelism=1
30-
pasword.method.argon2.hash-kength=32
25+
password.method.argon2.version=19
26+
password.method.argon2.salt-length=16
27+
password.method.argon2.memory=7168
28+
password.method.argon2.iterations=5
29+
password.method.argon2.parallelism=1
30+
password.method.argon2.hash-length=32
3131
```
3232

3333
After thess properties update `jans-auth` requires restart.
3434

35-
# Hash Passowrd format
35+
# Hash Password format
3636

3737
User password value in DB has format {TYPE}{BASE64 encoded hash}
3838

39-
Argon2 hashed passwords in DB has simular format. Each passowrd starts from`{ARGON2}` which follows Base64 encoded argon2 password **hash** with **properties**.
39+
Argon2 hashed passwords in DB has similar format. Each password starts from`{ARGON2}` which follows Base64 encoded argon2 password **hash** with **properties**.
4040

4141
Argon2 encoded format contains next parts:
4242
$**type**$v=**version**$m=**memory**,t=**iterations**,p=**parallelism**$Base64WithoutPadding(**salt**)$Base64WithoutPadding(**password_hash**)
@@ -53,13 +53,13 @@ $argon2i$v=19$m=7168,t=5,p=1$nHfg/bAe4rlKMY/trOV4gg$boZh/pomT2rGWOWJMEZx+9FkGIY5
5353
2. Override default setting with file `/etc/jans/conf/jans-sql.properties`
5454
```
5555
# Argon 2 parameters
56-
pasword.method.argon2.type=2
57-
pasword.method.argon2.version=19
58-
pasword.method.argon2.salt-length=16
59-
pasword.method.argon2.memory=32768
60-
pasword.method.argon2.iterations=10
61-
pasword.method.argon2.parallelism=1
62-
pasword.method.argon2.hash-kength=32
56+
password.method.argon2.type=2
57+
password.method.argon2.version=19
58+
password.method.argon2.salt-length=16
59+
password.method.argon2.memory=32768
60+
password.method.argon2.iterations=10
61+
password.method.argon2.parallelism=1
62+
password.method.argon2.hash-length=32
6363
```
6464

6565
```

jans-linux-setup/jans_setup/templates/jans-mysql.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ password.encryption.method=SSHA-256
2121

2222
# Argon 2 parameters
2323
# 0 - ARGON2_d, 1 - ARGON2_i, 2 - ARGON2_id
24-
#pasword.method.argon2.type=2
24+
#password.method.argon2.type=2
2525
# 1.0 - 16, 1.3 - 19
26-
#pasword.method.argon2.version=19
27-
#pasword.method.argon2.salt-length=16
28-
#pasword.method.argon2.memory=7168
29-
#pasword.method.argon2.iterations=5
30-
#pasword.method.argon2.parallelism=1
31-
#pasword.method.argon2.hash-kength=32
26+
#password.method.argon2.version=19
27+
#password.method.argon2.salt-length=16
28+
#password.method.argon2.memory=7168
29+
#password.method.argon2.iterations=5
30+
#password.method.argon2.parallelism=1
31+
#password.method.argon2.hash-length=32
3232

3333
# Connection pool size
3434
connection.pool.max-total=40

jans-linux-setup/jans_setup/templates/jans-pgsql.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ password.encryption.method=SSHA-256
1414

1515
# Argon 2 parameters
1616
# 0 - ARGON2_d, 1 - ARGON2_i, 2 - ARGON2_id
17-
#pasword.method.argon2.type=2
17+
#password.method.argon2.type=2
1818
# 1.0 - 16, 1.3 - 19
19-
#pasword.method.argon2.version=19
20-
#pasword.method.argon2.salt-length=16
21-
#pasword.method.argon2.memory=7168
22-
#pasword.method.argon2.iterations=5
23-
#pasword.method.argon2.parallelism=1
24-
#pasword.method.argon2.hash-kength=32
19+
#password.method.argon2.version=19
20+
#password.method.argon2.salt-length=16
21+
#password.method.argon2.memory=7168
22+
#password.method.argon2.iterations=5
23+
#password.method.argon2.parallelism=1
24+
#password.method.argon2.hash-length=32
2525

2626
# Connection pool size
2727
connection.pool.max-total=40

jans-orm/core/src/main/java/io/jans/orm/operation/auth/PasswordEncryptionHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public final class PasswordEncryptionHelper {
4141
public static final String ARGON2_MEMORY_KEY = "argon2.memory";
4242
public static final String ARGON2_ITERATIONS_KEY = "argon2.iterations";
4343
public static final String ARGON2_PARALLELISM_KEY = "argon2.parallelism";
44-
public static final String ARGON2_HASH_LENGTH_KEY = "argon2.hash-kength";
44+
public static final String ARGON2_HASH_LENGTH_KEY = "argon2.hash-length";
4545

4646
private PasswordEncryptionHelper() {
4747
}

jans-orm/sql/src/main/java/io/jans/orm/sql/operation/impl/SqlConnectionProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public class SqlConnectionProvider {
6767
private static final String MYSQL_QUERY_CONSTRAINT_CHECK = "SELECT CONSTRAINT_SCHEMA AS TABLE_SCHEMA, TABLE_NAME, CONSTRAINT_NAME, CHECK_CLAUSE AS DEFINITION FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS WHERE CONSTRAINT_SCHEMA = ? ORDER BY TABLE_SCHEMA, TABLE_NAME";
6868

6969
private static final String DRIVER_PROPERTIES_PREFIX = "connection.driver-property";
70-
private static final String PASSWORD_METHOD_PREFIX = "pasword.method";
70+
private static final String PASSWORD_METHOD_PREFIX = "password.method";
7171

7272
private Properties props;
7373

0 commit comments

Comments
 (0)