Blame lib/Authen/SASL.pod

Packit ae5a87
Packit ae5a87
=head1 NAME
Packit ae5a87
Packit ae5a87
Authen::SASL - SASL Authentication framework
Packit ae5a87
Packit ae5a87
=head1 SYNOPSIS
Packit ae5a87
Packit ae5a87
 use Authen::SASL;
Packit ae5a87
Packit ae5a87
 $sasl = Authen::SASL->new(
Packit ae5a87
   mechanism => 'CRAM-MD5 PLAIN ANONYMOUS',
Packit ae5a87
   callback => {
Packit ae5a87
     pass => \&fetch_password,
Packit ae5a87
     user => $user,
Packit ae5a87
   }
Packit ae5a87
 );
Packit ae5a87
Packit ae5a87
=head1 DESCRIPTION
Packit ae5a87
Packit ae5a87
SASL is a generic mechanism for authentication used by several
Packit ae5a87
network protocols. B<Authen::SASL> provides an implementation
Packit ae5a87
framework that all protocols should be able to share.
Packit ae5a87
Packit ae5a87
The framework allows different implementations of the connection
Packit ae5a87
class to be plugged in. At the time of writing there were two such
Packit ae5a87
plugins.
Packit ae5a87
Packit ae5a87
=over 4
Packit ae5a87
Packit ae5a87
=item Authen::SASL::Perl
Packit ae5a87
Packit ae5a87
This module implements several mechanisms and is implemented
Packit ae5a87
entirely in Perl.
Packit ae5a87
Packit ae5a87
=item Authen::SASL::XS
Packit ae5a87
Packit ae5a87
This module uses the Cyrus SASL C-library (both version 1 and 2 
Packit ae5a87
are supported).
Packit ae5a87
Packit ae5a87
=item Authen::SASL::Cyrus
Packit ae5a87
Packit ae5a87
This module is the predecessor to L<Authen::SASL::XS>. It is reccomended
Packit ae5a87
to use L<Authen::SASL::XS>
Packit ae5a87
Packit ae5a87
=back
Packit ae5a87
Packit ae5a87
By default the order in which these plugins are selected is 
Packit ae5a87
Authen::SASL::XS, Authen::SASL::Cyrus and then Authen::SASL::Perl.
Packit ae5a87
Packit ae5a87
If you want to change it or want to specifically use one
Packit ae5a87
implementation only simply do
Packit ae5a87
Packit ae5a87
 use Authen::SASL qw(Perl);
Packit ae5a87
Packit ae5a87
or if you have another plugin module that supports the Authen::SASL API
Packit ae5a87
Packit ae5a87
 use Authen::SASL qw(My::SASL::Plugin);
Packit ae5a87
Packit ae5a87
=head2 CONTRUCTOR
Packit ae5a87
Packit ae5a87
=over 4
Packit ae5a87
Packit ae5a87
=item new ( OPTIONS )
Packit ae5a87
Packit ae5a87
The constructor may be called with or without arguments. Passing arguments is
Packit ae5a87
just a short cut to calling the C<mechanism> and C<callback> methods.
Packit ae5a87
Packit ae5a87
=over 4
Packit ae5a87
Packit ae5a87
=item callback =E<gt> { NAME => VALUE, NAME => VALUE, ... }
Packit ae5a87
Packit ae5a87
Set the callbacks.
Packit ae5a87
See the L<callback|/callback> method for details.
Packit ae5a87
Packit ae5a87
=item mechanism =E<gt> NAMES
Packit ae5a87
Packit ae5a87
=item mech =E<gt> NAMES
Packit ae5a87
Packit ae5a87
Set the list of mechanisms to choose from.
Packit ae5a87
See the L<mechanism|/mechanism> method for details.
Packit ae5a87
Packit ae5a87
=item debug =E<gt> VALUE
Packit ae5a87
Packit ae5a87
Set the debug level bit-value to C<VALUE> 
Packit ae5a87
Packit ae5a87
Debug output will be sent to C<STDERR>. The
Packit ae5a87
bits of this value are:
Packit ae5a87
Packit ae5a87
 1   Show debug messages in the Perl modules for the mechanisms.
Packit ae5a87
     (Currently only used in GSSAPI)
Packit ae5a87
 4   With security layers in place show information on packages read.
Packit ae5a87
 8   With security layers in place show information on packages written.
Packit ae5a87
Packit ae5a87
The default value is 0.
Packit ae5a87
Packit ae5a87
=back
Packit ae5a87
Packit ae5a87
=back
Packit ae5a87
Packit ae5a87
=head2 METHODS
Packit ae5a87
Packit ae5a87
=over 4
Packit ae5a87
Packit ae5a87
=item mechanism ( )
Packit ae5a87
Packit ae5a87
Returns the current list of mechanisms
Packit ae5a87
Packit ae5a87
=item mechanism ( NAMES )
Packit ae5a87
Packit ae5a87
Set the list of mechanisms to choose from. C<NAMES> should be a space separated string
Packit ae5a87
of the names.
Packit ae5a87
Packit ae5a87
=item callback ( NAME )
Packit ae5a87
Packit ae5a87
Returns the current callback associated with C<NAME>.
Packit ae5a87
Packit ae5a87
=item callback ( NAME => VALUE, NAME => VALUE, ... )
Packit ae5a87
Packit ae5a87
Sets the given callbacks to the given values
Packit ae5a87
Packit ae5a87
=item client_new ( SERVICE, HOST, SECURITY )
Packit ae5a87
Packit ae5a87
Creates and returns a new connection object for a client-side connection.
Packit ae5a87
Packit ae5a87
=item server_new ( SERVICE, HOST, OPTIONS )
Packit ae5a87
Packit ae5a87
Creates and returns a new connection object for a server-side connection.
Packit ae5a87
Packit ae5a87
=item error ( )
Packit ae5a87
Packit ae5a87
Returns any error from the last connection
Packit ae5a87
Packit ae5a87
=back
Packit ae5a87
Packit ae5a87
=head1 The Connection Class
Packit ae5a87
Packit ae5a87
=over 4
Packit ae5a87
Packit ae5a87
=item server_start ( CHALLENGE )
Packit ae5a87
Packit ae5a87
server_start begins the authentication using the chosen mechanism.
Packit ae5a87
If the mechanism is not supported by the installed SASL it fails.
Packit ae5a87
Because for some mechanisms the client has to start the negotiation,
Packit ae5a87
you can give the client challenge as a parameter.
Packit ae5a87
Packit ae5a87
=item server_step ( CHALLENGE )
Packit ae5a87
Packit ae5a87
server_step performs the next step in the negotiation process. The
Packit ae5a87
first parameter you give is the clients challenge/response.
Packit ae5a87
Packit ae5a87
=item client_start ( )
Packit ae5a87
Packit ae5a87
The initial step to be performed. Returns the initial value to pass to the server
Packit ae5a87
or an empty list on error.
Packit ae5a87
Packit ae5a87
=item client_step ( CHALLENGE )
Packit ae5a87
Packit ae5a87
This method is called when a response from the server requires it. CHALLENGE
Packit ae5a87
is the value from the server. Returns the next value to pass to the server or an
Packit ae5a87
empty list on error.
Packit ae5a87
Packit ae5a87
=item need_step ( )
Packit ae5a87
Packit ae5a87
Returns true if the selected mechanism requires another step before completion
Packit ae5a87
(error or success).
Packit ae5a87
Packit ae5a87
=item answer ( NAME )
Packit ae5a87
Packit ae5a87
The method will return the value returned from the last call to the callback NAME
Packit ae5a87
Packit ae5a87
=item property ( NAME )
Packit ae5a87
Packit ae5a87
Returns the property value associated with C<NAME>.
Packit ae5a87
Packit ae5a87
=item property ( NAME => VALUE, NAME => VALUE, ... )
Packit ae5a87
Packit ae5a87
Sets the named properties to their associated values.
Packit ae5a87
Packit ae5a87
=item service ( )
Packit ae5a87
Packit ae5a87
Returns the service argument that was passed to *_new-methods.
Packit ae5a87
Packit ae5a87
=item host ( )
Packit ae5a87
Packit ae5a87
Returns the host argument that was passed to *_new-methods.
Packit ae5a87
Packit ae5a87
=item mechanism ( )
Packit ae5a87
Packit ae5a87
Returns the name of the chosen mechanism.
Packit ae5a87
Packit ae5a87
=item is_success ( )
Packit ae5a87
Packit ae5a87
Once need_step() returns false, then you can check if the authentication
Packit ae5a87
succeeded by calling this method which returns a boolean value.
Packit ae5a87
Packit ae5a87
=back
Packit ae5a87
Packit ae5a87
=head2 Callbacks
Packit ae5a87
Packit ae5a87
There are three different ways in which a callback may be passed
Packit ae5a87
Packit ae5a87
=over
Packit ae5a87
Packit ae5a87
=item CODEREF
Packit ae5a87
Packit ae5a87
If the value passed is a code reference then, when needed, it will be called
Packit ae5a87
and the connection object will be passed as the first argument. In addition
Packit ae5a87
some callbacks may be passed additional arguments.
Packit ae5a87
Packit ae5a87
=item ARRAYREF
Packit ae5a87
Packit ae5a87
If the value passed is an array reference, the first element in the array
Packit ae5a87
must be a code reference. When the callback is called the code reference
Packit ae5a87
will be called with the connection object passed as the first argument
Packit ae5a87
and all other values from the array passed after.
Packit ae5a87
Packit ae5a87
=item SCALAR
Packit ae5a87
Packit ae5a87
All other values passed will be used directly. ie it is the same as
Packit ae5a87
passing an code reference that, when called, returns the value.
Packit ae5a87
Packit ae5a87
=back
Packit ae5a87
Packit ae5a87
=head1 SEE ALSO
Packit ae5a87
Packit ae5a87
L<Authen::SASL::Perl>, L<Authen::SASL::XS>, L<Authen::SASL::Cyrus>
Packit ae5a87
Packit ae5a87
=head1 AUTHOR
Packit ae5a87
Packit ae5a87
Graham Barr <gbarr@pobox.com>
Packit ae5a87
Packit ae5a87
Please report any bugs, or post any suggestions, to the perl-ldap mailing list
Packit ae5a87
<perl-ldap@perl.org>
Packit ae5a87
Packit ae5a87
=head1 COPYRIGHT
Packit ae5a87
Packit ae5a87
Copyright (c) 1998-2005 Graham Barr. All rights reserved. This program is
Packit ae5a87
free software; you can redistribute it and/or modify it under the same
Packit ae5a87
terms as Perl itself.
Packit ae5a87
Packit ae5a87
=cut