public static class ScramClient.Builder extends ScramClient.PreBuilder2
ScramClient.channelBinding(ChannelBinding)
and chained methods.Modifier and Type | Field and Description |
---|---|
private java.util.Optional<ScramMechanism> |
channelBindingMechanism |
private int |
nonceLength |
private java.util.function.Supplier<java.lang.String> |
nonceSupplier |
private java.util.Optional<ScramMechanism> |
nonChannelBindingMechanism |
private java.security.SecureRandom |
secureRandom |
stringPreparation
channelBinding
Modifier | Constructor and Description |
---|---|
private |
Builder(ScramClient.ChannelBinding channelBinding,
StringPreparation stringPreparation,
java.util.Optional<ScramMechanism> nonChannelBindingMechanism,
java.util.Optional<ScramMechanism> channelBindingMechanism) |
Modifier and Type | Method and Description |
---|---|
ScramClient.Builder |
nonceLength(int length)
Sets a non-default (
ScramClient.DEFAULT_NONCE_LENGTH ) length for the nonce generation,
if no alternate nonceSupplier is provided via nonceSupplier(Supplier) . |
ScramClient.Builder |
nonceSupplier(java.util.function.Supplier<java.lang.String> nonceSupplier)
Optional call.
|
ScramClient.Builder |
secureRandomAlgorithmProvider(java.lang.String algorithm,
java.lang.String provider)
Optional call.
|
ScramClient |
setup()
Gets the client, fully constructed and configured, with the provided channel binding, string preparation
properties, and the selected SCRAM mechanism based on server supported mechanisms.
|
selectClientMechanism, selectMechanismBasedOnServerAdvertised, selectMechanismBasedOnServerAdvertisedCsv
stringPreparation
private final java.util.Optional<ScramMechanism> nonChannelBindingMechanism
private final java.util.Optional<ScramMechanism> channelBindingMechanism
private java.security.SecureRandom secureRandom
private java.util.function.Supplier<java.lang.String> nonceSupplier
private int nonceLength
private Builder(ScramClient.ChannelBinding channelBinding, StringPreparation stringPreparation, java.util.Optional<ScramMechanism> nonChannelBindingMechanism, java.util.Optional<ScramMechanism> channelBindingMechanism)
public ScramClient.Builder secureRandomAlgorithmProvider(java.lang.String algorithm, java.lang.String provider) throws java.lang.IllegalArgumentException
nonceSupplier(Supplier)
).
Algorithm and provider names are those supported by the SecureRandom
class.algorithm
- The name of the algorithm to use.provider
- The name of the provider of SecureRandom. Might be null.java.lang.IllegalArgumentException
- If algorithm is null, or either the algorithm or provider are not supportedpublic ScramClient.Builder nonceSupplier(java.util.function.Supplier<java.lang.String> nonceSupplier) throws java.lang.IllegalArgumentException
nonceSupplier
- A supplier of valid nonce Strings.
Please note that according to the
SCRAM RFC
only ASCII printable characters (except the comma, ',') are permitted on a nonce.
Length is not limited.java.lang.IllegalArgumentException
- If nonceSupplier is nullpublic ScramClient.Builder nonceLength(int length) throws java.lang.IllegalArgumentException
ScramClient.DEFAULT_NONCE_LENGTH
) length for the nonce generation,
if no alternate nonceSupplier is provided via nonceSupplier(Supplier)
.length
- The length of the nonce. Must be positive and greater than 0java.lang.IllegalArgumentException
- If length is less than 1public ScramClient setup()
ScramClient.DEFAULT_NONCE_LENGTH
length, unless nonceLength(int)
is called.