Class AuthConfig


  • public class AuthConfig
    extends Object
    Configuration for authentication with remote ML inference endpoints.

    Supports various authentication methods including API keys, bearer tokens, and custom headers. Use this when connecting to remote inference services like AWS SageMaker, Google Vertex AI, or custom REST APIs.

    Usage Example:

    
     // API Key authentication
     AuthConfig auth = AuthConfig.builder()
         .apiKey("your-api-key-here")
         .build();
    
     // Bearer token authentication
     AuthConfig auth = AuthConfig.builder()
         .token("Bearer eyJhbGc...")
         .build();
    
     // Custom headers
     AuthConfig auth = AuthConfig.builder()
         .headers(Map.of(
             "X-API-Key", "key123",
             "X-Client-ID", "client456"
         ))
         .build();
     
    Since:
    1.0.0
    Author:
    Nestor Martourez, Sr Software and Data Streaming Engineer @ CodedStreams
    • Constructor Detail

      • AuthConfig

        public AuthConfig​(String apiKey,
                          String token,
                          Map<String,​String> headers)
        Constructs authentication configuration.
        Parameters:
        apiKey - API key for authentication (can be null)
        token - bearer token for authentication (can be null)
        headers - custom HTTP headers for authentication
    • Method Detail

      • getApiKey

        public String getApiKey()
        Gets the API key.
        Returns:
        API key, or null if not configured
      • getToken

        public String getToken()
        Gets the bearer token.
        Returns:
        bearer token, or null if not configured
      • getHeaders

        public Map<String,​String> getHeaders()
        Gets custom authentication headers.
        Returns:
        immutable map of header name-value pairs
      • builder

        public static AuthConfig.Builder builder()
        Creates a new builder for AuthConfig.
        Returns:
        a new builder instance