Authen-Credential
view release on metacpan or search on metacpan
lib/Authen/Credential.pm view on Meta::CPAN
=head1 NAME
Authen::Credential - abstraction of a credential
=head1 SYNOPSIS
use Authen::Credential;
use Authen::Credential::plain;
use Getopt::Long qw(GetOptions);
use Config::General qw(ParseConfig);
use HTTP::Request;
# creation
$cred = Authen::Credential->new(
scheme => "plain",
name => "system",
pass => "manager",
);
# idem directly using the sub-class
$cred = Authen::Credential::plain->new(
name => "system",
lib/Authen/Credential.pm view on Meta::CPAN
# get credential from configuration file
%Option = ParseConfig(-ConfigFile => "...");
$cred = Authen::Credential->new($Option{auth});
# access the credential attributes
if ($cred->scheme() eq "plain") {
printf("user name is %s\n", $cred->name());
}
# use the prepare() method to get ready-to-use data
$req = HTTP::Request->new(GET => $url);
$req->header(Authorization => $cred->prepare("HTTP.Basic"));
=head1 DESCRIPTION
This module offers abstractions of credentials, i.e. something that
can be used to authenticate. It allows the creation and manipulation of
credentials. In particular, it defines a standard string representation
(so that credentials can be given to external programs as command line
options), a standard structured representation (so that credentials can
be stored in structured configuration files or using JSON) and
lib/Authen/Credential/plain.pm view on Meta::CPAN
=item HTTP.Basic
HTTP Basic authentication, it returns a string that can be used for
the C<WWW-Authenticate> header
=back
=head1 EXAMPLE
use Authen::Credential;
use HTTP::Request;
# get the credential from somewhere
$cred = Authen::Credential->parse(...);
# use the prepare() method to get ready-to-use data
$req = HTTP::Request->new(GET => $url);
$req->header(Authorization => $cred->prepare("HTTP.Basic"));
=head1 SEE ALSO
L<Authen::Credential>,
L<http://en.wikipedia.org/wiki/Basic_access_authentication>.
=head1 AUTHOR
Lionel Cons L<http://cern.ch/lionel.cons>
( run in 0.539 second using v1.01-cache-2.11-cpan-de7293f3b23 )