View Source Xandra.Authenticator behaviour (Xandra v0.17.0)

A behaviour module for implementing a Cassandra authenticator.

examples

Examples

defmodule MyAuthenticator do
  @behaviour Xandra.Authenticator

  def response_body(options) do
    ["user:", Keyword.fetch!(options, :user), "_password:", Keyword.fetch!(options, :password)]
  end
end

To use the authenticator defined above:

Xandra.start_link(authentication: {MyAuthenticator, user: "foo", password: "bar"})

Xandra supports Cassandra's PasswordAuthenticator by default, see Xandra.Authenticator.Password for more information.

Link to this section Summary

Callbacks

Returns an iodata that's used as the response body to Cassandra's auth challenge.

Link to this section Callbacks

@callback response_body(options :: keyword()) :: iodata()

Returns an iodata that's used as the response body to Cassandra's auth challenge.