Package com.ongres.scram.client
Interface ScramClient.FinalBuildStage
- All Known Implementing Classes:
ScramClient.Builder
- Enclosing class:
ScramClient
public static interface ScramClient.FinalBuildStage
Builder stage for the optional atributes and the final build() call.
-
Method Summary
Modifier and TypeMethodDescriptionSets the authzid.build()
Returns the fully contructed ScramClient ready to start the message flow with the server.channelBinding
(String cbindType, byte[] cbindData) If the client supports channel binding negotiation, this method sets the type and data used for channel binding.nonceLength
(int length) Sets a non-default length for the nonce generation.nonceSupplier
(Supplier<String> nonceSupplier) The client will use a default nonce generator, unless an external one is provided by this method.secureRandomAlgorithmProvider
(String algorithm, String provider) Selects a non-default SecureRandom instance, based on the given algorithm and optionally provider.stringPreparation
(StringPreparation stringPreparation) Sets the StringPreparation, is recommended to leave the default SASL_PREPARATION.
-
Method Details
-
channelBinding
If the client supports channel binding negotiation, this method sets the type and data used for channel binding.- Parameters:
cbindType
- channel bynding type namecbindData
- channel binding data- Returns:
this
builder for use in a chained invocation
-
stringPreparation
Sets the StringPreparation, is recommended to leave the default SASL_PREPARATION.- Parameters:
stringPreparation
- type of string preparation normalization- Returns:
this
builder for use in a chained invocation
-
authzid
Sets the authzid.- Parameters:
authzid
- the optional authorization id- Returns:
this
builder for use in a chained invocation
-
nonceLength
Sets a non-default length for the nonce generation.The default value is 24. This call overwrites the length used for the client nonce.
- Parameters:
length
- The length of the nonce. Must be positive and greater than 0- Returns:
this
builder for use in a chained invocation- Throws:
IllegalArgumentException
- If length is less than 1
-
nonceSupplier
The client will use a default nonce generator, unless an external one is provided by this method.- Parameters:
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.- Returns:
this
builder for use in a chained invocation- Throws:
IllegalArgumentException
- If nonceSupplier is null
-
secureRandomAlgorithmProvider
Selects a non-default SecureRandom instance, based on the given algorithm and optionally provider. This SecureRandom instance will be used to generate secure random values, like the ones required to generate the nonce. Algorithm and provider names are those supported by theSecureRandom
class.- Parameters:
algorithm
- The name of the algorithm to useprovider
- The name of the provider of SecureRandom. Might be null- Returns:
this
builder for use in a chained invocation- Throws:
IllegalArgumentException
- If algorithm is null, or either the algorithm or provider are not supported
-
build
ScramClient build()Returns the fully contructed ScramClient ready to start the message flow with the server.- Returns:
- ScramClient specific for the set of parameters
- Throws:
IllegalArgumentException
- if any parameter set is invalid
-