Blame api.txt

Packit ae5a87
Packit ae5a87
Client API
Packit ae5a87
----------
Packit ae5a87
Basically the Authen::SASL module gathers some info. When ->client_new
Packit ae5a87
is called the plugin is called to create a $conn object. At that point
Packit ae5a87
it should query the Authen::SASL object for mechanisms and callbacks
Packit ae5a87
Packit ae5a87
Properties are then set on the $conn object by calling $conn->property
Packit ae5a87
Packit ae5a87
Then client_start is called
Packit ae5a87
Packit ae5a87
Then we call client_step with a challenge string to get a response
Packit ae5a87
string. need_step can be called to check that this step is actually
Packit ae5a87
necessary for the selected mechanism.
Packit ae5a87
Packit ae5a87
Packit ae5a87
Quite simple really I think.
Packit ae5a87
Packit ae5a87
Packit ae5a87
So the plugin just needs to support
Packit ae5a87
Packit ae5a87
  client_new
Packit ae5a87
  client_start
Packit ae5a87
  client_step
Packit ae5a87
  need_step    # returns true if client_step needs to be called
Packit ae5a87
  property     # set/get for properties
Packit ae5a87
  mechanism    # returns the name of the chosen mechanism
Packit ae5a87
  service      # the service name passed to client_new
Packit ae5a87
  host         # the hostname passed to client_new
Packit ae5a87
  is_success   # returns true if authentication suceeded
Packit ae5a87
Packit ae5a87
Server API
Packit ae5a87
----------
Packit ae5a87
The server API is symetric to the client's one. server_new is called to
Packit ae5a87
create a connection object. Then server_start is called, and if relevant
Packit ae5a87
the first data from the client is passed to it as argument.
Packit ae5a87
Packit ae5a87
Then we call server_step with all the response from the clients, which
Packit ae5a87
returns challenges. need_step also determines if the current mechanism
Packit ae5a87
requires another step.
Packit ae5a87
Packit ae5a87
So the plugin just needs to support
Packit ae5a87
Packit ae5a87
  server_new
Packit ae5a87
  server_start
Packit ae5a87
  server_step
Packit ae5a87
  need_step    # returns true if client_step needs to be called
Packit ae5a87
  property     # set/get for properties
Packit ae5a87
  mechanism    # returns the name of the chosen mechanism
Packit ae5a87
  service      # the service name passed to client_new
Packit ae5a87
  host         # the hostname passed to client_new
Packit ae5a87
  is_success   # returns true if authentication suceeded
Packit ae5a87
Packit ae5a87
Callbacks
Packit ae5a87
---------
Packit ae5a87
properties and callbacks are passed by name, so you will need to convert
Packit ae5a87
them to numbers.
Packit ae5a87
Packit ae5a87
There are three types of call back
Packit ae5a87
Packit ae5a87
  user => 'fred'
Packit ae5a87
Packit ae5a87
When the user callback is called, it will just return the string 'fred'
Packit ae5a87
Packit ae5a87
  user => \&subname
Packit ae5a87
Packit ae5a87
When the user callback is called, &subname will be called and it will
Packit ae5a87
be passed the $conn object as the first argument.
Packit ae5a87
Packit ae5a87
  user => [ \&subname, 1, 2, 3]
Packit ae5a87
Packit ae5a87
When the user callback is called, &subname will be called. It will be passed
Packit ae5a87
the $conn object, followed by all other values in the array