Record Class TokenPlatformClientConfig

java.lang.Object
java.lang.Record
io.confluent.kafka.odyssey.auth.TokenPlatformClientConfig
Record Components:
tokenPlatformUrl - the Token Platform gRPC endpoint URL (always required)
authMode - the SPIRE authentication mode (always required)
spireAgentUrl - the SPIRE agent socket URL — used iff authMode == SPIRE_AGENT
namespace - the Kubernetes namespace for the SVID secret — used iff authMode == SPIRE_K8S_SECRET
serviceAcct - the Kubernetes service account name for the SVID secret — used iff authMode == SPIRE_K8S_SECRET
podLabel - the optional pod label for the SVID secret — null is the convention for K1 brokers (mirrors SpireX509ClientK8sSupplier and SpireClientFactory). Only consulted when authMode == SPIRE_K8S_SECRET.
requestTimeoutMs - gRPC request timeout in milliseconds
maxRetries - maximum number of retry attempts for transient failures

public record TokenPlatformClientConfig(String tokenPlatformUrl, TokenPlatformClientConfig.AuthMode authMode, String spireAgentUrl, String namespace, String serviceAcct, String podLabel, int requestTimeoutMs, int maxRetries) extends Record
Immutable configuration for TokenPlatformClient.

This record holds all configuration needed to connect to the Token Platform service using SPIRE mTLS authentication. Two SPIRE auth modes are supported:

Use the create(String, String) factory for SPIRE_AGENT mode and the createWithK8sSecret(String, String, String, String) factory for SPIRE_K8S_SECRET mode. Field-level validation (which credentials are required for which mode, timeout/retry ranges) lives upstream in OdysseyIntegrationManager.Builder.build(); the compact constructor only enforces null safety on the always-required fields to avoid duplicating the same checks at multiple layers.

  • Field Details

    • DEFAULT_REQUEST_TIMEOUT_MS

      public static final int DEFAULT_REQUEST_TIMEOUT_MS
      Default request timeout: 5 seconds
      See Also:
    • DEFAULT_MAX_RETRIES

      public static final int DEFAULT_MAX_RETRIES
      Default max retries: 3 attempts
      See Also:
  • Constructor Details

    • TokenPlatformClientConfig

      public TokenPlatformClientConfig(String tokenPlatformUrl, TokenPlatformClientConfig.AuthMode authMode, String spireAgentUrl, String namespace, String serviceAcct, String podLabel, int requestTimeoutMs, int maxRetries)
      Compact constructor — null safety only. All other validation (mode-specific credential presence, timeout/retry ranges) is handled upstream in OdysseyIntegrationManager.Builder.build() ahead of construction.
  • Method Details

    • create

      public static TokenPlatformClientConfig create(String tokenPlatformUrl, String spireAgentUrl)
      Creates a configuration for SPIRE agent mode with default timeout and retry settings.
      Parameters:
      tokenPlatformUrl - the Token Platform gRPC endpoint URL
      spireAgentUrl - the SPIRE agent socket URL
      Returns:
      a new configuration instance with TokenPlatformClientConfig.AuthMode.SPIRE_AGENT
    • createWithK8sSecret

      public static TokenPlatformClientConfig createWithK8sSecret(String tokenPlatformUrl, String namespace, String serviceAcct, String podLabel)
      Creates a configuration for SPIRE K8s-secret mode with default timeout and retry settings.

      Used by K1 broker pods, which do not have a SPIRE Workload API socket mounted but do have a SPIRE-issued SVID provisioned as a Kubernetes secret. The SVID is read via the Kubernetes API at runtime.

      Parameters:
      tokenPlatformUrl - the Token Platform gRPC endpoint URL
      namespace - the Kubernetes namespace for the SVID secret
      serviceAcct - the Kubernetes service account name
      podLabel - optional pod label; pass null for the K1 broker convention
      Returns:
      a new configuration instance with TokenPlatformClientConfig.AuthMode.SPIRE_K8S_SECRET
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tokenPlatformUrl

      public String tokenPlatformUrl()
      Returns the value of the tokenPlatformUrl record component.
      Returns:
      the value of the tokenPlatformUrl record component
    • authMode

      Returns the value of the authMode record component.
      Returns:
      the value of the authMode record component
    • spireAgentUrl

      public String spireAgentUrl()
      Returns the value of the spireAgentUrl record component.
      Returns:
      the value of the spireAgentUrl record component
    • namespace

      public String namespace()
      Returns the value of the namespace record component.
      Returns:
      the value of the namespace record component
    • serviceAcct

      public String serviceAcct()
      Returns the value of the serviceAcct record component.
      Returns:
      the value of the serviceAcct record component
    • podLabel

      public String podLabel()
      Returns the value of the podLabel record component.
      Returns:
      the value of the podLabel record component
    • requestTimeoutMs

      public int requestTimeoutMs()
      Returns the value of the requestTimeoutMs record component.
      Returns:
      the value of the requestTimeoutMs record component
    • maxRetries

      public int maxRetries()
      Returns the value of the maxRetries record component.
      Returns:
      the value of the maxRetries record component