This module defines the cqerl_auth_handler behaviour.
Required callback functions: auth_init/3, auth_handle_challenge/2, auth_handle_success/2, auth_handle_error/2.
Handler for SASL-based authentication with Cassandra
Authentication with cassandra can take any form, as long as it follows SASL principles. The actual implementation (what each message will contain) depends on the method used. Cassandra can be configured to use a certain class for authentication, and you can configure CQErl to use custom handler modules to match the server implementation.
auth_init/3
will be called by CQErl upon receiving a
request from the server to start authentication. Arguments are:
binary()
){Ip, Port}
tuple where Ip
is a tuple of integers
of length 4 (v4) or 16 (v6).Return type can be {reply, Reply :: binary(), State :: any()}
or
{close, Reason :: any()}
.
auth_handle_challenge/2
will be called every time a challenge
is received from Cassandra. The arguments are the challenge (as binary()
)
and state. The return type is the same as auth_init
.
auth_handle_success/2
will be called when Cassandra indicates
authentication success. The arguments are a final message sent along the sucess
response (as binary()
) and state. The return type can be ok
or {close, Reason}
.
auth_handle_error/2
will be called when Cassandra replies with a
authentication error. The arguments are a final message sent along the error
response (as binary()
) and state. The return value is not used.Generated by EDoc