Class SecuritySettings
java.lang.Object
com.codingchili.core.configuration.system.SecuritySettings
- All Implemented Interfaces:
Configurable
,Serializable
Contains mappings of security dependencies between services.
For example: service A may depend on a shared secret with service B, or depend on service B generating a token of its secret.
To establish such dependencies, a dependency is added to service A
with a path or a regex to match the path of service B. The
AuthenticationDependency
class contains the type of
configuration that is requested, for example a token or shared secret.
- See Also:
- Serialized Form
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddDependency(String path, AuthenticationDependency dependency)
Loads a certificate from disk and saves it with the given name.getArgon()
Retrieve a keystore given its short name (ID).getDependency(String path)
getKeystore(String storeId)
getPath()
Get the path of a loaded configuration file.int
int
void
setArgon(ArgonSettings argon)
void
setDependencies(Map<String,AuthenticationDependency> dependencies)
void
setHmacAlgorithm(String hmacAlgorithm)
setKeystores(Set<KeyStoreReference> keystores)
void
setSecretBytes(int secretBytes)
void
setSignatureAlgorithm(String signatureAlgorithm)
Sets the signature algorithm to use for signing.setTokenttl(int tokenttl)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.codingchili.core.configuration.Configurable
save, serialize, setPath
-
Constructor Details
-
SecuritySettings
public SecuritySettings()
-
-
Method Details
-
getPath
Description copied from interface:Configurable
Get the path of a loaded configuration file.- Specified by:
getPath
in interfaceConfigurable
- Returns:
- the directory path to the configuration file.
-
addKeystore
Loads a certificate from disk and saves it with the given name. Requires manual input to enter the secret for the keystore.- Returns:
- a keystore builder.
-
getKeystore
- Parameters:
storeId
- name of the keystore to retrieve: the mapped shortname of the filename with extension.- Returns:
- a keystore if it is loaded, if no keystore is added with the given shortname uses a self signed certificate. If it fails to load a keystore then the application shuts down.
-
getByName
Retrieve a keystore given its short name (ID).- Parameters:
storeId
- the store id to retrieve.- Returns:
- a keystore that matches the given id, empty otherwise.
-
getKeystores
- Returns:
- a list of configured keystores.
-
setKeystores
- Parameters:
keystores
- keystores to set- Returns:
- fluent
-
getSecretBytes
public int getSecretBytes()- Returns:
- the number of bytes a secret must have at a minimum.
-
setSecretBytes
public void setSecretBytes(int secretBytes)- Parameters:
secretBytes
- the number of bytes generated secrets consists of.
-
getArgon
- Returns:
- argon2 parameters used for password hashing.
-
setArgon
- Parameters:
argon
- the argon2 parameters used for password hashing.
-
getSignatureAlgorithm
- Returns:
- the signature algorithm to use for signatures.
-
setSignatureAlgorithm
Sets the signature algorithm to use for signing.supported by the default provider: - SHA1withDSA - SHA1withRSA - SHA256withRSA
- Parameters:
signatureAlgorithm
- the algorithm identifier to use.
-
getHmacAlgorithm
- Returns:
- the HMAC algorithm identifier used to create HMAC tokens.
-
setHmacAlgorithm
- Parameters:
hmacAlgorithm
- the HMAC algorithm used to create HMAC tokens, the specified algorithm must be available in the JVM.
-
getDependencies
- Returns:
- a map of dependencies, where the key is the regex that match other configurations. The value contains the actual security configuration to be applied.
-
setDependencies
- Parameters:
dependencies
- set the security configuration dependencies.
-
getDependency
- Parameters:
path
- the regex (compared as text) dependency identifier.- Returns:
- the defined dependency with the given dependency path.
-
addDependency
- Parameters:
path
- a regex to match the path of configuration files that the dependency applies to.dependency
- the dependency that requires security parameters from files that the path mataches.- Returns:
- fluent
-
getTokenttl
public int getTokenttl()- Returns:
- the time to live for generated tokens in seconds.
-
setTokenttl
- Parameters:
tokenttl
- the time to live for generated tokens in seconds.- Returns:
- fluent.
-