Package io.smallrye.config
Class SecretKeys
java.lang.Object
io.smallrye.config.SecretKeys
- All Implemented Interfaces:
Serializable
Provide a way to control the access to Secret Keys.
A Secret Key is a plain configuration name that modifies the behaviour of the config system by:
- Omitting the name of the secret in
SmallRyeConfig.getPropertyNames() - Omitting the name and value of the secret in the mapping
toStringmethod - Throwing a
SecurityExceptionwhen trying to retrieve the value viaSmallRyeConfigprogrammatic API
SmallRyeConfigBuilder.withSecretKeys(String...) or by wrapping a member type of a
ConfigMapping with Secret.
Secret Keys are locked by default. Locking and unlocking keys is a local operation to the current executing thread.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidExecutes aRunnablewith no access to the Secret Keys.static <T> TGet the result of aSupplierwith no access to the Secret Keys.static voiddoUnlocked(Runnable runnable) Executes aRunnablewith full access to the Secret Keys.static <T> TdoUnlocked(Supplier<T> supplier) Get the result of aSupplierwith full access to the Secret Keys.static booleanisLocked()Check if the Secret Keys are locked.
-
Constructor Details
-
SecretKeys
public SecretKeys()
-
-
Method Details
-
isLocked
public static boolean isLocked()Check if the Secret Keys are locked.- Returns:
trueif the Secret Keys are locked orfalseotherwise.
-
doUnlocked
Executes aRunnablewith full access to the Secret Keys.- Parameters:
runnable- the code to execute
-
doUnlocked
Get the result of aSupplierwith full access to the Secret Keys.- Type Parameters:
T- the type of results- Parameters:
supplier- aSupplierto retrieve the results- Returns:
- the result
-
doLocked
Executes aRunnablewith no access to the Secret Keys.- Parameters:
runnable- the code to execute
-
doLocked
Get the result of aSupplierwith no access to the Secret Keys.- Type Parameters:
T- the type of results- Parameters:
supplier- aSupplierto retrieve the results- Returns:
- the result
-