Class OutboundTargetDefinition.Builder

java.lang.Object
io.helidon.security.providers.httpsign.OutboundTargetDefinition.Builder
All Implemented Interfaces:
Builder<OutboundTargetDefinition.Builder,OutboundTargetDefinition>, Supplier<OutboundTargetDefinition>
Enclosing class:
OutboundTargetDefinition

public static final class OutboundTargetDefinition.Builder extends Object implements Builder<OutboundTargetDefinition.Builder,OutboundTargetDefinition>
Fluent API builder to build OutboundTargetDefinition instances. Call build() to create a new instance.
  • Method Details

    • keyId

      Key id of this service (will be mapped by target service to validate signature).
      Parameters:
      keyId - key id mapped by target service
      Returns:
      updated builder instance
    • header

      Header to store signature in.
      Parameters:
      header - header type
      Returns:
      updated builder instance
    • algorithm

      public OutboundTargetDefinition.Builder algorithm(String algorithm)
      Algorithm used by this signature. Set automatically on call to methods privateKeyConfig(KeyConfig) and hmacSecret(byte[]).
      Parameters:
      algorithm - algorithm to use for outbound signatures
      Returns:
      updated builder instance
    • privateKeyConfig

      public OutboundTargetDefinition.Builder privateKeyConfig(KeyConfig keyConfig)
      Private key configuration for RSA based algorithms. If called sets the algorithm to "rsa-sha256". Expects either explicit private key, or keystore and private key alias.
      Parameters:
      keyConfig - private key configuration for outbound signatures
      Returns:
      updated builder instance
    • signedHeaders

      Configuration of required and "if-present" headers to be signed for this target. Defaults to the same as HttpSignProvider.Builder.inboundRequiredHeaders(SignedHeadersConfig).
      Parameters:
      config - configuration of outbound headers to be signed for each method.
      Returns:
      updated builder instance
    • hmacSecret

      public OutboundTargetDefinition.Builder hmacSecret(byte[] secret)
      Shared secret for HMAC based algorithms. Also sets the algorithm to "hmac-sha256"
      Parameters:
      secret - secret to sign outgoing requests (symmetric)
      Returns:
      updated builder instance
    • hmacSecret

      public OutboundTargetDefinition.Builder hmacSecret(String secret)
      Shared secret for HMAC based algorithms. Calls hmacSecret(byte[]) getting bytes of the secret string with UTF-8.
      Parameters:
      secret - shared secret to sign outgoing requests
      Returns:
      updated builder instance
    • tokenHandler

      public OutboundTargetDefinition.Builder tokenHandler(TokenHandler tokenHandler)
      Configure a token handler to create the outbound header.
      Parameters:
      tokenHandler - token handler to use
      Returns:
      updated builder instance
    • build

      public OutboundTargetDefinition build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<OutboundTargetDefinition.Builder,OutboundTargetDefinition>
      Returns:
      instance of the built type
    • config

      public OutboundTargetDefinition.Builder config(Config config)
      Update this builder instance from configuration.
      Parameters:
      config - config instance
      Returns:
      updated builder instance
    • backwardCompatibleEol

      public OutboundTargetDefinition.Builder backwardCompatibleEol(Boolean backwardCompatible)
      Enable support for Helidon versions before 3.0.0 (exclusive).

      Until version 3.0.0 (exclusive) there was a trailing end of line added to the signed data. To be able to communicate cross versions, we must configure this when talking to older versions of Helidon. Default value is false. In Helidon 2.x, this switch exists as well and the default is true, to allow communication between versions as needed.

      Parameters:
      backwardCompatible - whether to run in backward compatible mode
      Returns:
      updated builder instance