Interface AuthenticationInitContext


public interface AuthenticationInitContext
Runtime services handed to Authentication.initializeAsync(AuthenticationInitContext) once when the client is built (PIP-478).

The framework owns and closes these shared services (HTTP clients, scheduler, blocking executor); the implementation may retain references for the lifetime of the client and releases its own resources in Authentication.close().

  • Method Details

    • httpClientFactory

      org.apache.pulsar.http.PulsarHttpClientFactory httpClientFactory()
      Factory for PulsarHttpClient instances. The framework manages lifecycle (event loop, timer, DNS cache, TLS material refresh integration); plugins describe what they need via a PulsarHttpClientConfig and receive a configured instance owned by the framework. Multiple instances with different TLS / timeouts may be obtained for different uses (e.g. OAuth2 mTLS to the IdP vs HTTP topic lookup).

      Plugins MUST NOT construct private HTTP clients directly — doing so defeats the framework's shared event-loop / DNS / refresh integration.

      Returns:
      the framework's HTTP client factory
    • scheduler

      Scheduler for delayed / periodic authentication work (e.g. proactive credential renewal). Never the Netty event loop. Reserved for scheduled tasks — potentially-blocking work belongs on blockingExecutor().
      Returns:
      the framework-owned scheduler
    • blockingExecutor

      Executor blockingExecutor()
      Dedicated executor for off-loading potentially-blocking authentication work, kept separate from scheduler() so that blocking calls cannot starve the scheduler's threads or delay scheduled tasks. The LegacyV4AuthenticationAdapter offloads every synchronous v4 plugin call here. Never the Netty event loop. Framework-owned and shared per PulsarClient.
      Returns:
      the framework-owned blocking executor
    • clock

      Clock clock()
      Returns:
      the clock used by implementations that schedule against wall-clock time
    • openTelemetry

      io.opentelemetry.api.OpenTelemetry openTelemetry()
      Returns:
      the telemetry root; the framework defaults to OpenTelemetry.noop() if unset
    • clientInstanceId

      String clientInstanceId()
      Returns:
      a stable id of the owning PulsarClient, for logging correlation