public static class ScramClient.Builder extends ScramClient.PreBuilder2
ScramClient.channelBinding(ChannelBinding)
and chained methods.Modifier and Type | Field and Description |
---|---|
private ScramMechanism |
channelBindingMechanism |
private int |
nonceLength |
private NonceSupplier |
nonceSupplier |
private ScramMechanism |
nonChannelBindingMechanism |
private java.security.SecureRandom |
secureRandom |
stringPreparation
channelBinding
Modifier | Constructor and Description |
---|---|
private |
Builder(ScramClient.ChannelBinding channelBinding,
StringPreparation stringPreparation,
ScramMechanism nonChannelBindingMechanism,
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(NonceSupplier) . |
ScramClient.Builder |
nonceSupplier(NonceSupplier 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 ScramMechanism nonChannelBindingMechanism
private final ScramMechanism channelBindingMechanism
private java.security.SecureRandom secureRandom
private NonceSupplier nonceSupplier
private int nonceLength
private Builder(ScramClient.ChannelBinding channelBinding, StringPreparation stringPreparation, ScramMechanism nonChannelBindingMechanism, ScramMechanism channelBindingMechanism)
public ScramClient.Builder secureRandomAlgorithmProvider(java.lang.String algorithm, java.lang.String provider) throws java.lang.IllegalArgumentException
nonceSupplier(NonceSupplier)
).
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(NonceSupplier 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(NonceSupplier)
.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.