AIS-client
view release on metacpan or search on metacpan
AIS/client version 0.05
=======================
Authenticate a user of a HTTP web page using the kerberos-like AIS
(Authenticated Identity Service) protocol, using netscape cookies,
defaulting to the pay2send.com public AIS server.
A persistent per-session stash is provided in addition to the
user's authenticated identity.
This version has not been tested under mod_perl, but future
versions will be.
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
NOCOO:
print <<EOF;
Content-Type: text/plain
Cookies appear to be disabled in your web browser.
Cookie string: $ENV{HTTP_COOKIE}
This program uses a session and authentication system
(AIS, the Authenticated Identity Service)
that relies on cookies.
Please enable cookies and try again. (you may have to log in)
*******************************************************************
You appear to be using a $ENV{HTTP_USER_AGENT}
from $ENV{REMOTE_ADDR}
to access http$ssl_ext://$ENV{SERVER_NAME}$ENV{SCRIPT_NAME}
EOF
exit;
HAVE_ID:
$Sessions{$Coo}->{last_access} = time;
$Identity = $Sessions{$Coo}->{identity};
if($Identity eq 'ERROR'){
print <<EOF;
Content-type: text/plain
There was an error with the authentication layer
of this web service: $Sessions{$Coo}->{error}
please contact $ENV{SERVER_ADMIN} to report this.
EOF
exit;
};
# print STDERR "setting ",caller().'::AIS_IDENTITY', " to $Sessions{$Coo}->{identity}\n";
1;
__END__
1;
__END__
=head1 NAME
AIS::client - get an authenticated e-mail address for users of your web service
=head1 SYNOPSIS
BEGIN{umask(0077 & umask())}; # if your web server gives you a 0177 umask
use AIS::client;
print "Content-type: text/plain\n\nWelcome $AIS_IDENTITY\n";
print "this is page view number ", ++$AIS_STASH{accesses};
__END__
=head1 DESCRIPTION
The goal of AIS::client is to provide a very easy way to require an
authenticated identity for a perl web application. The user's e-mail
address appears in a global variable C<$AIS_IDENTITY> and a persistent
session stash is available in C<%AIS_STASH>.
=head1 USE-LINE CONFIGURATION OPTIONS
=item aissri
By default, AIS::client will refer to the AIS service defined
at http://www.pay2send.com/cgi/ais/ but an alternate AIS service
can be specified with the C<aissri> parameter:
# `make test'. After `make install' it should work as `perl test.pl'
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
use Test;
BEGIN { plan tests => 2 };
BEGIN {print <<EOF };
AIS::client redirects and exits, only achieving it's
aim of authenticating a user against a central AIS server
after at least three state-altering calls to itself.
If you can figure out a way to write a test harness for
it I'll gladly accept the patch.
under these lines you should see something like
Set-Cookie:/AIS_session=SomE1RanDoM5GaRBagE
Location: http://?AIS_INITIAL
--------------------------------------------
EOF
( run in 2.388 seconds using v1.01-cache-2.11-cpan-5c0b1e786e0 )