đ Authen::SASL â SASL Authentication framework
| Use Case | Command | Description |
|---|---|---|
| đĻ Create SASL object | Authen::SASL->new(mechanism => '...', callback => {...}) | đ§ Initialize SASL authentication with mechanisms and callbacks |
| đ Select Perl-only implementation | use Authen::SASL qw(Perl) | đ ī¸ Force use of Authen::SASL::Perl plugin |
| đ¤ Client-side connection | $sasl->client_new($service, $host, $security) | đ Create a new client connection object |
| đĨī¸ Server-side connection | $sasl->server_new($service, $host, $options) | đī¸ Create a new server connection object |
| đĻ Client start | $conn->client_start() | âļī¸ Begin authentication from client side |
| đ¨ Client step | $conn->client_step($challenge) | đ Process server challenge and return response |
| đĻ Server start | $conn->server_start($challenge) | âļī¸ Begin authentication from server side |
| đ¨ Server step | $conn->server_step($challenge) | đ Process client challenge and return response |
| â Check success | $conn->is_success() | âī¸ Returns true if authentication succeeded |
| đ Check need step | $conn->need_step() | âŗ Returns true if more steps are required |
| đĸ Get error | $sasl->error() | â Get last error message |
use Authen::SASL;
$sasl = Authen::SASL->new(
mechanism => 'CRAM-MD5 PLAIN ANONYMOUS',
callback => {
pass => \&fetch_password,
user => $user,
}
);
đ SASL is a generic mechanism for authentication used by several network protocols. Authen::SASL provides an implementation framework that all protocols should be able to share.
đī¸ The framework allows different implementations of the connection class to be plugged in. At the time of writing there were two such plugins.
đ By default the order in which these plugins are selected is Authen::SASL::XS, Authen::SASL::Cyrus and then Authen::SASL::Perl.
đ¯ If you want to change it or want to specifically use one implementation only simply do:
use Authen::SASL qw(Perl);
or if you have another plugin module that supports the Authen::SASL API:
use Authen::SASL qw(My::SASL::Plugin);
đ§ The constructor may be called with or without arguments. Passing arguments is just a short cut to calling the mechanism and callback methods.
callback => { NAME => VALUE, NAME => VALUE, ... } đ Set the callbacks. See the callback method for details.mechanism => NAMES / mech => NAMES đ Set the list of mechanisms to choose from. See the mechanism method for details.debug => VALUE đ Set the debug level bit-value to VALUE.đ Debug output will be sent to STDERR. The bits of this value are:
đ The default value is 0.
mechanism ( ) đ Returns the current list of mechanismsmechanism ( NAMES ) đ Set the list of mechanisms to choose from. NAMES should be a space separated string of the names.callback ( NAME ) đ Returns the current callback associated with NAME.callback ( NAME => VALUE, NAME => VALUE, ... ) đ Sets the given callbacks to the given valuesclient_new ( SERVICE, HOST, SECURITY ) đ Creates and returns a new connection object for a client-side connection.server_new ( SERVICE, HOST, OPTIONS ) đĨī¸ Creates and returns a new connection object for a server-side connection.error ( ) â Returns any error from the last connectionserver_start ( CHALLENGE ) âļī¸ server_start begins the authentication using the chosen mechanism. If the mechanism is not supported by the installed SASL it fails. Because for some mechanisms the client has to start the negotiation, you can give the client challenge as a parameter.server_step ( CHALLENGE ) đ server_step performs the next step in the negotiation process. The first parameter you give is the clients challenge/response.client_start ( ) âļī¸ The initial step to be performed. Returns the initial value to pass to the server or an empty list on error.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 or an empty list on error.need_step ( ) âŗ Returns true if the selected mechanism requires another step before completion (error or success).answer ( NAME ) đ The method will return the value returned from the last call to the callback NAMEproperty ( NAME ) đ Returns the property value associated with NAME.property ( NAME => VALUE, NAME => VALUE, ... ) đ Sets the named properties to their associated values.service ( ) đ Returns the service argument that was passed to *_new-methods.host ( ) đ Returns the host argument that was passed to *_new-methods.mechanism ( ) đ Returns the name of the chosen mechanism.is_success ( ) â
Once need_step() returns false, then you can check if the authentication succeeded by calling this method which returns a boolean value.đ There are three different ways in which a callback may be passed:
Authen::SASL::Perl, Authen::SASL::XS, Authen::SASL::Cyrus
đ¨âđģ Graham Barr <gbarr@pobox.com>
đŦ Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org>
đ Copyright (c) 1998-2005 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-16 10:15 @2600:1f28:365:80b0:7cb9:fb:26c1:e368
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)