Apache2-AuthCASSimple
view release on metacpan or search on metacpan
lib/Apache2/AuthCASSimple.pm view on Meta::CPAN
return $user;
}
else {
$r->log()->info(__PACKAGE__.": Session found, but no data inside it.");
$s->delete_session();
return "";
}
}
#
# _create_user_session()
#
# Create a user session and send cookie
#
sub _create_user_session ($) {
my $r = shift;
my $mod_proxy = $r->dir_config('ModProxy');
my $cas_session_dir = $r->dir_config('CASSessionDirectory') || '/tmp';
my $cas_cookie_path = $r->dir_config('CASFixDirectory') || '/';
my $is_https = $r->dir_config('HTTPSServer') || 0;
$r->log()->info(__PACKAGE__.": Creating session for ".$r->user());
my $s = Apache::Session::Wrapper->new(
class => 'File',
directory => $cas_session_dir,
lock_directory => $cas_session_dir,
use_cookie => 1,
cookie_secure => $is_https,
cookie_resend => 1,
cookie_expires => 'session',
cookie_path => $cas_cookie_path
);
unless ($s) {
$r->log()->info(__PACKAGE__.": Unable to create session for ".$r->connection->user().".");
return;
}
$r->log()->info(__PACKAGE__.": Session id ".$s->{session_id});
$s->session->{'CASUser'} = $r->user();
my $ip = ($mod_proxy)?$r->headers_in->{'X-Forwarded-For'}:$r->connection->remote_ip();
$s->session->{'CASIP'} = $ip;
$s->session->{'time'} = time();
};
1;
__END__
=head1 NAME
Apache2::AuthCASSimple - Apache2 module to authentificate through a CAS server
=head1 DESCRIPTION
Apache2::AuthCASSimple is an authentication module for Apache2/mod_perl2. It allow you to authentificate users through a Yale CAS server. It means you don't need to give login/password if you've already be authentificate by the CAS server, only ticke...
This module allow the use of simple text files for sessions.
=head1 SYNOPSIS
PerlOptions +GlobalRequest
<Location /protected>
AuthType Apache2::AuthCASSimple
PerlAuthenHandler Apache2::AuthCASSimple
PerlSetVar CASServerName my.casserver.com
PerlSetVar CASServerPath /
# PerlSetVar CASServerPort 443
# PerlSetVar CASServerNoSSL 1
PerlSetVar CASSessionTimeout 3660
PerlSetVar CASSessionDirectory /tmp
# PerlSetVar CASFixDirectory /
# PerlSetVar ModProxy 1
# PerlSetVar HTTPSServer 1
require valid-user
</Location>
or
order deny,allow
deny from all
require user xxx yyyy
satisfy any
=head1 CONFIGURATION
=over 4
=item CASServerName
Name of the CAS server. It can be a numeric IP address.
=item CASServerPort
Port of the CAS server. Default is 443.
=item CASServerPath
Path (URI) of the CAS server. Default is "/cas".
=item CASServerNoSSL
Disable SSL transaction wih CAS server (HTTPS). Default is off.
=item CASCaFile
CAS server public key. This file is used to allow secure connection
between the webserver using Apache2::AuthCASSimple and the CAS server.
( run in 1.458 second using v1.01-cache-2.11-cpan-2398b32b56e )