View Source KafkaEx.Auth.Mechanism behaviour (kafka_ex v0.15.0)
Behaviour for SASL authentication mechanisms.
Each mechanism must implement:
mechanism_name/1- Returns the mechanism name for SASL handshakeauthenticate/2- Performs the authentication exchange
Built-in Implementations
KafkaEx.Auth.SASL.Plain- Simple username/password (requires TLS)KafkaEx.Auth.SASL.Scram- Challenge-response with SHA-256/512
Extending Authentication
To implement a custom mechanism:
defmodule MyAuth do @behaviour KafkaEx.Auth.Mechanism
@impl true def mechanism_name(_config), do: "OAUTHBEARER"
@impl true def authenticate(config, send_fun) do
# Exchange authentication messages with broker
# using send_fun to send and receive data
:okend end
Summary
Callbacks
Performs the authentication exchange after handshake.
Returns mechanism name for handshake.
Types
@type auth_opts() :: KafkaEx.Auth.Config.t()
Callbacks
Performs the authentication exchange after handshake.
Returns mechanism name for handshake.