Interface ScramClient.FinalBuildStage

Enclosing class:
ScramClient

public static interface ScramClient.FinalBuildStage
Builder stage for the optional atributes and the final build() call.
  • 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 name
      cbindData - channel binding data
      Returns:
      this builder for use in a chained invocation
      API Note:
      If cbindType or cbindData are 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:
      this builder for use in a chained invocation
    • authzid

      ScramClient.FinalBuildStage authzid(@NotNull @NotNull String authzid)
      Sets the authzid.
      Parameters:
      authzid - the optional authorization id
      Returns:
      this builder for use in a chained invocation
    • nonceLength

      ScramClient.FinalBuildStage nonceLength(int length)
      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

      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:
      this builder 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 the SecureRandom class.
      Parameters:
      algorithm - The name of the algorithm to use
      provider - 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