Skip to content

Commit 0915075

Browse files
authored
Merge pull request #50759 from jcjveraa/jcjveraa-elytron-security-properties-documentation-patch
Elytron Security Properties File - set password hashing algorithm to SHA512
2 parents bddda4e + 7678ac0 commit 0915075

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

extensions/elytron-security-properties-file/deployment/src/test/resources/application-custom-auth-embedded-encrypted.properties

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
#passwords generated with `echo -n username:realm:password | md5`
1+
#passwords generated with `echo -n username:realm:password | sha256sum`
22

33
quarkus.security.users.embedded.enabled=true
4+
quarkus.security.users.embedded.algorithm=digest-sha-256
45
#jb0ss
5-
quarkus.security.users.embedded.users.scott=7861e1b73a3bf980a7505bcc156f2cdc
6+
quarkus.security.users.embedded.users.scott=5e3bb937a3847692ef98fd74733c3711b2a6e024a0f954bbd99dc166c5fa4163
67
#test
7-
quarkus.security.users.embedded.users.stuart=0f1f62b147e724bae51e4079c97cd199
8+
quarkus.security.users.embedded.users.stuart=7d45ca4b4b18ab8cdf1d70c15b18a59a4977eb912e8909f7d8b194df570b398a
89
#p4ssw0rd
9-
quarkus.security.users.embedded.users.jdoe=7b1bc0186206a7c7bb2009406f43cad6
10+
quarkus.security.users.embedded.users.jdoe=2c4a1b2ee85f00ebefe617cda4139c1d1a83e3ed6336db7e50de01a35e2a72f2
1011
#n0Adm1n
11-
quarkus.security.users.embedded.users.noadmin=4fbab5d88ae52c698e0452fdbf135969
12+
quarkus.security.users.embedded.users.noadmin=2f0211b0516de610a77a88d967f80686537fbb20aa532bd932c8dc2b7c27d0f1
1213
quarkus.security.users.embedded.roles.scott=Admin,admin,Tester,user
1314
quarkus.security.users.embedded.roles.stuart=admin,user
1415
quarkus.security.users.embedded.roles.jdoe=NoRolesUser

extensions/elytron-security-properties-file/runtime/src/main/java/io/quarkus/elytron/security/properties/runtime/MPRealmRuntimeConfig.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,25 @@
2121
public interface MPRealmRuntimeConfig {
2222

2323
/**
24-
* If the properties are stored in plain text. If this is false (the default) then it is expected
25-
* that the passwords are of the form HEX( MD5( username ":" realm ":" password ) )
24+
* If the passwords are stored in the property file as plain text, e.g.
25+
* {@code quarkus.security.users.embedded.users.alice=AlicesSecretPassword}.
26+
* If this is false (the default) then it is expected that passwords are hashed as per the {@code algorithm} config
27+
* property.
2628
*/
2729
@WithDefault("false")
2830
boolean plainText();
2931

3032
/**
31-
* Determine which algorithm to use.
33+
* The algorithm with which user password is hashed. The library expects a password prepended with the username and the
34+
* realm,
35+
* in the form ALG( username ":" realm ":" password ) in hexadecimal format.
3236
* <p>
37+
* For example, on a Unix-like system we can produce the expected hash for Alice logging in to the Quarkus realm with
38+
* password AlicesSecretPassword using {@code echo -n "alice:Quarkus:AlicesSecretPassword" | sha512sum}, and thus set
39+
* {@code quarkus.security.users.embedded.users.alice=c8131...4546} (full hash output abbreviated here).
3340
* This property is ignored if {@code plainText} is true.
3441
*/
35-
@WithDefault(DigestPassword.ALGORITHM_DIGEST_MD5)
42+
@WithDefault(DigestPassword.ALGORITHM_DIGEST_SHA_512)
3643
DigestAlgorithm algorithm();
3744

3845
/**

0 commit comments

Comments
 (0)