AIS-client
view release on metacpan or search on metacpan
To install this module type the following:
perl Makefile.PL
make
make test
make install
DEPENDENCIES
This module requires these other modules and libraries:
DirDB (but another persistence framework would work too.)
COPYRIGHT AND LICENCE
Copyright (C) 2004 David Nicol davidnico@cpan.org
released under GNU public license (GPL)
eval{
tie %Sessions => DirDB => "${SessionPrefix}_sessions";
};
if($@){
print <<EOF;
Content-Type: text/plain
AIS::client module was not able to open DirDB [${SessionPrefix}_sessions]
eval result:
$@
AIS::client version $VERSION
EOF
exit;
};
};
# issue the AIS QUERY request
# carp "doing miniget $host, $port,${aissri}query?$OTUkey, $agent";
my $Response = miniget $host, $port,
"${aissri}query?$OTUkey", $agent;
# carp "got $Response";
(my $AISXML) =
$Response =~ m#<aisresponse>(.+)</aisresponse>#si
or die "no <aisresponse> element from ${aissri}query?$OTUkey\n in BEGINRESPONSE\n$Response\nENDRESPONSE";
$Sessions{$Coo}->{AISXML} = $AISXML;
# parse AISXML...
my %aisvar;
foreach (qw{
identity
error
aissri
user_remote_addr
}
# ,@{$Param{XML}}
# exit;
#POSIX:_exit(0); # perldoc -f exit
exec '/usr/bin/true';
};
# HAVEOTUKEYEVAL
};
goto HAVE_ID;
}else{
# redirect us to AIS server PRESENT function
redirect "${aissri}present?http$ssl_ext://$ENV{SERVER_NAME}$ENV{SCRIPT_NAME}$ENV{PATH_INFO}?OTU_KEY=";
exit;
};
# NOIDENTITYEVAL
};
}else{
# no cookie.
my $suffix = '';
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:
use AIS::client prefix => '.AIS'; # hide session directory
The prefix is also used as the prefix for the session cookie name,
which defaults to C<AIS_session>.
=item freq
By default, AIS::client will examine the session directory for stale
sessions approximately once every 2000 invocations. Adjust this
with the C<freq> parameter. C<0> will suppress housekeeping entirely.
=item maxage
Minimum time in seconds since C<$AIS_STASH{last_access}> that will
trigger session deletion at housekeeping time. Defaults to C<72*60*60>.
=head1 ENDING SESSIONS
AIS::client recognizes a reserved QUERY_STRING of C<LOGOUT> which will
end a session, delete all session data, and offer the user a link to
the logout function of the specified AIS server so they can log out
of that too if they want.
=head1 HISTORY
=over 8
=item 0.05
( run in 0.647 second using v1.01-cache-2.11-cpan-49f99fa48dc )