Class CommandCredentialSource.Builder
java.lang.Object
org.wildfly.security.credential.source.impl.CommandCredentialSource.Builder
- Enclosing class:
- CommandCredentialSource
A builder for a command credential source.
-
Method Summary
Modifier and TypeMethodDescriptionaddCommand(String commandString) Add a command string to the list of command strings.addCommand(Consumer<Consumer<String>> consumer) Add a command string provider to the list of command strings.addCommand(Supplier<String> commandStringSupplier) Add a command string supplier result to the list of command strings.addEnvironment(String key, String value) Add an environment value to the process environment.addEnvironment(Consumer<BiConsumer<String, String>> consumer) Add multiple environment values to the process environment.build()Construct the credential source instance.removeEnvironment(String key) Remove an environment variable from the process environment.setOutputCharset(Charset charset) Set the output character set (encoding) to expect from the process.setPasswordFactoryProvider(Provider provider) Set the provider to use to find the password factory.setWorkingDirectory(File directory) Set the working directory of the target process.
-
Method Details
-
addCommand
Add a command string to the list of command strings.- Parameters:
commandString- the literal string to add (must not benull)- Returns:
- this builder
-
addCommand
Add a command string supplier result to the list of command strings. If the supplier returnsnullor an empty string, no string is added at that time. The supplier is evaluated every time a command is run.- Parameters:
commandStringSupplier- the string supplier to get the string from (must not benull)- Returns:
- this builder
-
addCommand
Add a command string provider to the list of command strings. The provider can add multiple strings to the consumer that is provided to it. The provider must not providenullor empty strings.- Parameters:
consumer- the consumer which can provide the command strings to add (must not benull)- Returns:
- this builder
-
addEnvironment
Add an environment value to the process environment.- Parameters:
key- the environment variable name (must not benull)value- the environment variable value (must not benull)- Returns:
- this builder
-
addEnvironment
Add multiple environment values to the process environment. The consumer is called once for every command execution.- Parameters:
consumer- a consumer which can provide key-value pairs to add to the environment (must not benull)- Returns:
- this builder
-
removeEnvironment
Remove an environment variable from the process environment.- Parameters:
key- the environment variable name (must not benull)- Returns:
- this builder
-
setWorkingDirectory
Set the working directory of the target process.- Parameters:
directory- the directory (must not benull)- Returns:
- this builder
-
setPasswordFactoryProvider
Set the provider to use to find the password factory. If this method is not called, the default is used.- Parameters:
provider- the provider to use (must not benull)- Returns:
- this builder
-
setOutputCharset
Set the output character set (encoding) to expect from the process. If this method is not called, the system default character set is used.- Parameters:
charset- the character set to use (must not benull)- Returns:
- this builder
-
build
Construct the credential source instance.- Returns:
- the credential source
- Throws:
GeneralSecurityException- if there was a failure constructing the password factory
-