Interface Authentication

All Superinterfaces:
AutoCloseable, Closeable

public interface Authentication extends Closeable
Pluggable authentication provider for Pulsar clients.

Implementations must be thread-safe.

  • Method Summary

    Modifier and Type
    Method
    Description
    Get the authentication data to be sent to the broker.
    authData(String brokerHostName)
    Get the authentication data for a specific broker host.
    The authentication method name (e.g., "token", "tls").
    default void
     
    default void
    Initialize the authentication provider.
  • Method Details

    • authMethodName

      String authMethodName()
      The authentication method name (e.g., "token", "tls").
      Returns:
      the authentication method identifier string
    • authData

      Get the authentication data to be sent to the broker.
      Returns:
      the authentication data containing credentials for the broker
      Throws:
      PulsarClientException - if the authentication data could not be obtained
    • authData

      default AuthenticationData authData(String brokerHostName) throws PulsarClientException
      Get the authentication data for a specific broker host.

      The default implementation delegates to authData().

      Parameters:
      brokerHostName - the hostname of the broker to authenticate against
      Returns:
      the authentication data containing credentials for the specified broker
      Throws:
      PulsarClientException - if the authentication data could not be obtained
    • initialize

      default void initialize() throws PulsarClientException
      Initialize the authentication provider. Called once when the client is created.
      Throws:
      PulsarClientException - if initialization fails
    • close

      default void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable