Class Argon2PasswordEncoderConfigurationProperties
java.lang.Object
io.micronaut.security.password.argon2.Argon2PasswordEncoderConfigurationProperties
- All Implemented Interfaces:
Argon2PasswordEncoderConfiguration
@ConfigurationProperties("micronaut.security.password.argon2")
@Context
@ValidArgon2Costs
@Internal
public final class Argon2PasswordEncoderConfigurationProperties
extends Object
implements Argon2PasswordEncoderConfiguration
Binds configuration for the Argon2id password encoder.
The configuration is bound and validated when the application context starts, so an invalid configuration prevents the application from starting.
- Since:
- 5.5.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault hash length, in bytes.static final intDefault number of iterations.static final intDefault highest number of iterations accepted when verifying an encoded password.static final intDefault highest memory cost, in kibibytes, accepted when verifying an encoded password.static final intDefault memory cost, in kibibytes.static final intDefault degree of parallelism.static final intDefault salt length, in bytes.static final StringConfiguration prefix for the Argon2id password encoder. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintintintintintintvoidsetHashLength(int hashLength) Sets the length, in bytes, of the hash generated for each encoded password.voidsetIterations(int iterations) Sets the number of iterations used to encode passwords.voidsetMaxIterations(int maxIterations) Sets the highest number of iterations accepted when verifying an encoded password.voidsetMaxMemory(int maxMemory) Sets the highest memory cost, in kibibytes, accepted when verifying an encoded password.voidsetMemory(int memory) Sets the memory cost, in kibibytes, used to encode passwords.voidsetParallelism(int parallelism) Sets the degree of parallelism used to encode passwords.voidsetSaltLength(int saltLength) Sets the length, in bytes, of the salt generated for each encoded password.
-
Field Details
-
PREFIX
-
DEFAULT_MEMORY
public static final int DEFAULT_MEMORYDefault memory cost, in kibibytes.- See Also:
-
DEFAULT_ITERATIONS
public static final int DEFAULT_ITERATIONSDefault number of iterations.- See Also:
-
DEFAULT_PARALLELISM
public static final int DEFAULT_PARALLELISMDefault degree of parallelism.- See Also:
-
DEFAULT_SALT_LENGTH
public static final int DEFAULT_SALT_LENGTHDefault salt length, in bytes.- See Also:
-
DEFAULT_HASH_LENGTH
public static final int DEFAULT_HASH_LENGTHDefault hash length, in bytes.- See Also:
-
DEFAULT_MAX_MEMORY
public static final int DEFAULT_MAX_MEMORYDefault highest memory cost, in kibibytes, accepted when verifying an encoded password.- See Also:
-
DEFAULT_MAX_ITERATIONS
public static final int DEFAULT_MAX_ITERATIONSDefault highest number of iterations accepted when verifying an encoded password.- See Also:
-
-
Constructor Details
-
Argon2PasswordEncoderConfigurationProperties
public Argon2PasswordEncoderConfigurationProperties()
-
-
Method Details
-
getMemory
public int getMemory()- Specified by:
getMemoryin interfaceArgon2PasswordEncoderConfiguration- Returns:
- the memory cost, in kibibytes, used to encode passwords
-
setMemory
public void setMemory(int memory) Sets the memory cost, in kibibytes, used to encode passwords. It must be at least eight times the parallelism and at most the maximum memory. Default value (19456).- Parameters:
memory- the memory cost, in kibibytes
-
getIterations
public int getIterations()- Specified by:
getIterationsin interfaceArgon2PasswordEncoderConfiguration- Returns:
- the number of iterations used to encode passwords
-
setIterations
public void setIterations(int iterations) Sets the number of iterations used to encode passwords. It must be at least 1 and at most the maximum iterations. Default value (2).- Parameters:
iterations- the number of iterations
-
getParallelism
public int getParallelism()- Specified by:
getParallelismin interfaceArgon2PasswordEncoderConfiguration- Returns:
- the degree of parallelism used to encode passwords
-
setParallelism
public void setParallelism(int parallelism) Sets the degree of parallelism used to encode passwords. It must be between 1 and 255. Default value (1).- Parameters:
parallelism- the degree of parallelism
-
getSaltLength
public int getSaltLength()- Specified by:
getSaltLengthin interfaceArgon2PasswordEncoderConfiguration- Returns:
- the length of the generated salt, in bytes
-
setSaltLength
public void setSaltLength(int saltLength) Sets the length, in bytes, of the salt generated for each encoded password. It must be between 8 and 48. Default value (16).- Parameters:
saltLength- the salt length, in bytes
-
getHashLength
public int getHashLength()- Specified by:
getHashLengthin interfaceArgon2PasswordEncoderConfiguration- Returns:
- the length of the generated hash, in bytes
-
setHashLength
public void setHashLength(int hashLength) Sets the length, in bytes, of the hash generated for each encoded password. It must be between 12 and 64. Default value (32).- Parameters:
hashLength- the hash length, in bytes
-
getMaxMemory
public int getMaxMemory()- Specified by:
getMaxMemoryin interfaceArgon2PasswordEncoderConfiguration- Returns:
- the highest memory cost, in kibibytes, accepted when verifying an encoded password
-
setMaxMemory
public void setMaxMemory(int maxMemory) Sets the highest memory cost, in kibibytes, accepted when verifying an encoded password. An encoded password that declares a higher memory cost does not match any password. Default value (262144).- Parameters:
maxMemory- the highest memory cost, in kibibytes
-
getMaxIterations
public int getMaxIterations()- Specified by:
getMaxIterationsin interfaceArgon2PasswordEncoderConfiguration- Returns:
- the highest number of iterations accepted when verifying an encoded password
-
setMaxIterations
public void setMaxIterations(int maxIterations) Sets the highest number of iterations accepted when verifying an encoded password. An encoded password that declares more iterations does not match any password. Default value (10).- Parameters:
maxIterations- the highest number of iterations
-