mirror of
https://github.com/keycloak/keycloak.git
synced 2025-12-19 05:20:21 -06:00
Configure Argon2's type correctly in Argon2PasswordHashProviderFactory
Closes #40232 Signed-off-by: Rutger Lubbers <RutgerLubbers@gmail.com>
This commit is contained in:
@@ -30,7 +30,7 @@ public class Argon2PasswordHashProviderFactory implements PasswordHashProviderFa
|
|||||||
* When we run more, this only leads to an increased memory usage and to throttling of the process in containerized environments
|
* When we run more, this only leads to an increased memory usage and to throttling of the process in containerized environments
|
||||||
* when a CPU limit is imposed. The throttling would have a negative impact on other concurrent non-hashing activities of Keycloak.
|
* when a CPU limit is imposed. The throttling would have a negative impact on other concurrent non-hashing activities of Keycloak.
|
||||||
*/
|
*/
|
||||||
private Semaphore cpuCoreSempahore;
|
private Semaphore cpuCoreSemaphore;
|
||||||
|
|
||||||
private String version;
|
private String version;
|
||||||
private String type;
|
private String type;
|
||||||
@@ -41,18 +41,18 @@ public class Argon2PasswordHashProviderFactory implements PasswordHashProviderFa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PasswordHashProvider create(KeycloakSession session) {
|
public PasswordHashProvider create(KeycloakSession session) {
|
||||||
return new Argon2PasswordHashProvider(version, type, hashLength, memory, iterations, parallelism, cpuCoreSempahore);
|
return new Argon2PasswordHashProvider(version, type, hashLength, memory, iterations, parallelism, cpuCoreSemaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Config.Scope config) {
|
public void init(Config.Scope config) {
|
||||||
version = config.get(VERSION_KEY, Argon2Parameters.DEFAULT_VERSION);
|
version = config.get(VERSION_KEY, Argon2Parameters.DEFAULT_VERSION);
|
||||||
type = config.get(VERSION_KEY, Argon2Parameters.DEFAULT_TYPE);
|
type = config.get(TYPE_KEY, Argon2Parameters.DEFAULT_TYPE);
|
||||||
hashLength = config.getInt(HASH_LENGTH_KEY, Argon2Parameters.DEFAULT_HASH_LENGTH);
|
hashLength = config.getInt(HASH_LENGTH_KEY, Argon2Parameters.DEFAULT_HASH_LENGTH);
|
||||||
memory = config.getInt(MEMORY_KEY, Argon2Parameters.DEFAULT_MEMORY);
|
memory = config.getInt(MEMORY_KEY, Argon2Parameters.DEFAULT_MEMORY);
|
||||||
iterations = config.getInt(ITERATIONS_KEY, Argon2Parameters.DEFAULT_ITERATIONS);
|
iterations = config.getInt(ITERATIONS_KEY, Argon2Parameters.DEFAULT_ITERATIONS);
|
||||||
parallelism = config.getInt(PARALLELISM_KEY, Argon2Parameters.DEFAULT_PARALLELISM);
|
parallelism = config.getInt(PARALLELISM_KEY, Argon2Parameters.DEFAULT_PARALLELISM);
|
||||||
cpuCoreSempahore = new Semaphore(config.getInt(CPU_CORES_KEY, Runtime.getRuntime().availableProcessors()));
|
cpuCoreSemaphore = new Semaphore(config.getInt(CPU_CORES_KEY, Runtime.getRuntime().availableProcessors()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user