Mark Adamson

NAME

Authen::SASL::Cyrus - XS SASL Authentication

SYNOPSIS

 use Authen::SASL;

 $sasl = Authen::SASL->new(
   mechanism => 'NAME',
   callback => { NAME => VALUE, NAME => VALUE, ... },
 );


 $conn = $sasl->client_new(<service>, <server>);

DESCRIPTION

SASL is a generic mechanism for authentication used by several network protocols. Authen::SASL::Cyrus provides an implementation framework that all protocols should be able to share.

The XS framework makes calls into the existing libsasl2.so shared library to perform SASL client connection functionality, including loading existing shared library mechanisms.

CONSTRUCTOR

The contructor may be called with or without arguments. Passing arguments is just a short cut to calling the mechanism and callback methods.

client_new( SERVICE, HOST )

Creates and returns a new connection object blessed into Authen::SASL::Cyrus. It is on that returned reference that the following methods are available. The SERVICE is the name of the service being implemented, which may be used by the underlying mechanism. An example service is "ldap". The HOST is the name of the server being contacted, which may also be used by the underlying mechanism.

Authen::SASL::Cyrus METHODS

callback ( NAME )

Tells if the named callback has a handler installed. The list of implemented callbacks is "user", "auth", and "language". Others may be implemented in future releases.

callback( NAME => VALUE, NAME => VALUE, ... )

Sets the given callback(s) to the given value(s). See the Callbacks section for a description of callback VALUEs. See above for a list of implemented callback NAMEs.

client_start

The initial step to be performed. Returns the initial value to pass to the server.

client_step( CHALLENGE )

This method is called when a response from the server requires it. CHALLENGE is the value from the server. Returns the next value to pass to the server.

code

Returns a 1 if an error has occurred in any step along the way. See the error method to get a better explanation of what error occurred. Returns a 0 if no errors have occurred.

error

Returns a string with a brief description of what caused the last error, AND clears the error message so that subsequent calls will return an empty string until another error occurs.

host

Returns the host argument that was passed to client_new =item mechanism

Returns the SASL mechanism currently in use. It should match one of the installed SASL shared library mechanisms (see your SASL distribution for a list of available mechanisms).

property( NAME )

Gets the SASL value for the named property. Currently implemented property names are: "user", "ssf", "maxout", "realm", "optctx", "iplocal" | "sockname", "ipremote" | "peername".

property( NAME => VALUE, NAME => VALUE, ... )

Sets the named property(ies) to the given value(s). Currently implemented property names are given above.

service

Returns the service argument that was passed to client_new

Callbacks

There are three different ways in which a callback may be passed

CODEREF

If the value passed is a code reference then, when needed, it will be called and the connection object will be passed as the first argument.

ARRAYREF

If the value passed is an array reference, the first element in the array must be a code reference. When the callback is called the code reference will be called with the connection object passed as the first argument and the second value from the array passed after. The code reference should return a scalar value which is the answer to the callback, e.g. a "user" callback should return a single string which is the username of the client.

SCALAR

All other values passed will be returned directly to the SASL library as the answer to the callback.

SEE ALSO

Authen::SASL

AUTHOR

Mark Adamson <mark@nb.net>

Please report any bugs, or post any suggestions, to the author.

COPYRIGHT

Copyright (c) 2005 Carnegie Mellon University. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 35:

'=item' outside of any '=over'

Around line 44:

You forgot a '=back' before '=head2'