Salvador Fandiño García > Authen-DigestMD5-0.04 > Authen::DigestMD5

Download:
Authen-DigestMD5-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  

NAME ^

Authen::DigestMD5 - SASL DIGEST-MD5 authentication (RFC2831)

SYNOPSIS ^

  use Authen::DigestMD5;

  use OnLDAP;
  $ld=OnLDAP::Client->new($host);
  ($rc, $id)=$ld->sasl_bind(undef, 'DIGEST-MD5');
  ($rc, $msg)=$ld->result($id);
  ($rc, $req)=$ld->parse_sasl_bind_result($msg);

  print "IN: |$req|\n";
  my $request=Authen::DigestMD5::Request->new($req);
  my $response=Authen::DigestMD5::Response->new;
  $response->got_request($request);
  $response->set(username => $user,
                 realm => $realm,
                 'digest-uri' => "ldap/$host");
  $response->add_digest(password=>$passwd);
  my $res=$response->output;
  print "OUT: |$res|\n";

  ($rc, $id)=$ld->sasl_bind(undef, 'DIGEST-MD5', $res);
  ($rc, $msg)=$ld->result($id);
  ($rc, $req)=$ld->parse_sasl_bind_result($msg);

  $request->input($req);
  print $request->auth_ok ? "AUTH OK\n" : "AUTH FAILED\n"

ABSTRACT ^

This module supports DIGEST-MD5 SASL authentication as defined on RFC-2831.

DESCRIPTION ^

This module implements three classes:

Authen::DigestMD5::Packet

base class implementing common methods to process SASL DIGEST-MD5 strings or objects:

Authen::DigestMD5::Packet->new(%props)
Authen::DigestMD5::Packet->new($input, %props)

create a new object with the properties in %props. If $input is passed it is parsed and the values obtained from it added to the object.

$pkt->input($input)

parses the properties on the string $input and adds them to the object.

$pkt->output()

packs all the properties on the object as a string suitable for sending to a SASL DIGEST-MD5 server or client.

$pkg->set($k1=>$v1, $k2=>$v2, ...)
$pkg->set(%props)

set object properties.

($v1, $v2, ...)=$pkg->get($k1, $k2, ...)

gets object properties.

$pkg->reset()

clears public object properties. Some internal properties like nc counters are retained.

Authen::DigestMD5::Request

class to represent SASL DIGEST-MD5 requests as obtained from a server.

$req->auth_ok()

returns a true value if the request object contains a valid authentication token.

Authen::DigestMD5::Response

class to represent and generate SASL DIGEST-MD5 responses suitables for sending to a server.

$res->got_request($req)

adds certain properties to the response $res object generated from the request $req ones.

$res->add_digest(password => $password)

adds the response property containing the MD5 digest to the response object.

SEE ALSO ^

Be sure to look at Authen::SASL because it is very likely that it is what you are looking for (Authen::DigestMD5 is only suitable when you need a finer control over the authentication procedure).

SASL DIGEST-MD5 RFC http://www.ietf.org/rfc/rfc2831.txt.

AUTHOR ^

Salvador Fandiño, <sfandino@yahoo.com>

COPYRIGHT AND LICENSE ^

Copyright 2003 by Salvador Fandiño.

Portions of this module have been copied from the Authen::SASL package by Graham Barr.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: