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 Detail

      • channelBinding

        ScramClient.FinalBuildStage channelBinding​(@Nullable
                                                   @Nullable java.lang.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
      • 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 java.lang.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:
        java.lang.IllegalArgumentException - If length is less than 1
      • nonceSupplier

        ScramClient.FinalBuildStage nonceSupplier​(@NotNull
                                                  @NotNull java.util.function.Supplier<@NotNull java.lang.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:
        java.lang.IllegalArgumentException - If nonceSupplier is null
      • secureRandomAlgorithmProvider

        ScramClient.FinalBuildStage secureRandomAlgorithmProvider​(@NotNull
                                                                  @NotNull java.lang.String algorithm,
                                                                  @Nullable
                                                                  @Nullable java.lang.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:
        java.lang.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:
        java.lang.IllegalArgumentException - if any parameter set is invalid