Behaviour for providing authentication credentials to KubeMQ.
Implement this behaviour to supply dynamic tokens (e.g., rotating OIDC tokens).
For static tokens, use KubeMQ.StaticTokenProvider or the :auth_token client option.
Example
defmodule MyTokenProvider do
@behaviour KubeMQ.CredentialProvider
@impl true
def get_token(_opts) do
case MyVault.fetch_token("kubemq") do
{:ok, token} -> {:ok, token}
{:error, reason} -> {:error, reason}
end
end
end
{:ok, client} = KubeMQ.Client.start_link(
address: "localhost:50000",
client_id: "my-app",
credential_provider: MyTokenProvider
)
Summary
Callbacks
Retrieve an authentication token.