Package com.ongres.scram.client
Interface ScramClient.FinalBuildStage
- 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(@Nullable String cbindType, byte @Nullable [] 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(@NotNull Supplier<@NotNull String> nonceSupplier) The client will use a default nonce generator, unless an external one is provided by this method.secureRandomAlgorithmProvider(@NotNull String algorithm, @Nullable String provider) Selects a non-default SecureRandom instance, based on the given algorithm and optionally provider.stringPreparation(@NotNull StringPreparation stringPreparation) Sets the StringPreparation, is recommended to leave the default SASL_PREPARATION.
-
Method Details
-
channelBinding
ScramClient.FinalBuildStage channelBinding(@Nullable @Nullable String cbindType, byte @Nullable [] cbindData) 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:
thisbuilder for use in a chained invocation- API Note:
- If
cbindTypeorcbindDataare null, sets the gs2-cbind-flag to 'n' and does not use channel binding.
-
stringPreparation
ScramClient.FinalBuildStage stringPreparation(@NotNull @NotNull StringPreparation stringPreparation) Sets the StringPreparation, is recommended to leave the default SASL_PREPARATION.- Parameters:
stringPreparation- type of string preparation normalization- Returns:
thisbuilder for use in a chained invocation
-
authzid
Sets the authzid.- Parameters:
authzid- the optional authorization id- Returns:
thisbuilder 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:
thisbuilder for use in a chained invocation- Throws:
IllegalArgumentException- If length is less than 1
-
nonceSupplier
ScramClient.FinalBuildStage nonceSupplier(@NotNull @NotNull Supplier<@NotNull String> 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:
thisbuilder for use in a chained invocation- Throws:
IllegalArgumentException- If nonceSupplier is null- API Note:
- you should rely on the default randomly generated nonce instead of this, this call exists mostly for testing with a predefined nonce
-
secureRandomAlgorithmProvider
ScramClient.FinalBuildStage secureRandomAlgorithmProvider(@NotNull @NotNull String algorithm, @Nullable @Nullable String provider) 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 theSecureRandomclass.- Parameters:
algorithm- The name of the algorithm to useprovider- The name of the provider of SecureRandom. Might be null- Returns:
thisbuilder 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
-