Apache2-SiteControl
view release on metacpan or search on metacpan
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Apache2-SiteControl
version: 1.05
version_from:
installdirs: site
requires:
Apache2::AuthCookie: 3.08
Apache2::Request: 2.05
Apache::Session::File: 1.54
Crypt::CAST5: 0.04
Crypt::CBC: 2.14
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17
Makefile.PL view on Meta::CPAN
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
NAME => 'Apache2::SiteControl',
VERSION => '1.05',
PREREQ_PM => { Apache2::AuthCookie => 3.08,
Apache::Session::File => 1.54,
Apache2::Request => 2.05,
Crypt::CBC => 2.14,
Crypt::CAST5 => 0.04,
# Authen::Radius => 0.10, optional
}, # e.g., Module::Name => 1.1
ABSTRACT => 'An object-oriented, fine-grained site access control facility',
AUTHOR => 'Tony Kay <tkay@uoregon.edu>',
);
Apache Notes
============
This package allows you to create a complex site authorization system where
specific actions on resources are given custom rules. It extends
Apache::AuthCookie to track sessions. It has been tested with Apache 1 and 2,
and seems to work well. There are sample sites in the samples directory. The
differences in the two apache environments require slightly different setups,
so be sure to use the proper sample for your configuration.
Use Apache2::SiteControl for apache 2.x.
Description
===========
There are two levels of control in Apache::SiteControl.
lib/Apache2/SiteControl.pm view on Meta::CPAN
package Apache2::SiteControl;
use 5.008;
use strict;
use warnings;
use Carp;
use Apache2::AuthCookie;
use Apache::Session::File;
our $VERSION = "1.05";
use base qw(Apache2::AuthCookie);
our %managers = ();
sub getCurrentUser
{
my $this = shift;
my $r = shift;
my $debug = $r->dir_config("SiteControlDebug") || 0;
my $factory = $r->dir_config("SiteControlUserFactory") || "Apache2::SiteControl::UserFactory";
my $auth_type = $r->auth_type;
my $auth_name = $r->auth_name;
my ($ses_key) = ($r->headers_in->{"Cookie"} || "") =~ /$auth_type\_$auth_name=([^;]+)/;
$r->log_error("Session cookie: " . ($ses_key ? $ses_key:"UNSET")) if $debug;
$r->log_error("Loading module $factory") if $debug;
eval "require $factory" or $r->log_error("Could not load $factory: $@");
$r->log_error("Using user factory $factory") if $debug;
my $username = $r->user();
return undef if(!$username);
$r->log_error("user name is $username") if $debug;
my $user = undef;
lib/Apache2/SiteControl/User.pm view on Meta::CPAN
It is assumed that you will be working from mod_perl, and some of the methods
require an Apache request object. The request object is used by some methods to
coordinate access to the actual session information in the underlying system
(for storing attributes and implementing logout).
User objects are created by a factory (by default
Apache2::SiteControl::UserFactory), so if you subclass User, you must understand
the complete interaction between the factory (which is responsible for
interfacing with persistence), the SiteControl, etc.
The default implementation of User and UserFactory use AuthCookie to manage the
sessions, and Apache::Session::File to store the various details about a user
to disk.
If you are using Apache2::SiteControl::User and Apache::SiteControl::UserFactory
(the default and recommended), then you should configure the following
parameters in your apache configuration file:
# This is where the session data files will be stored
SiteControlSessions directory_name
# This is where the locks will be stored
sample/apache_sitecontrol.conf view on Meta::CPAN
# Choose a name for the instance of the authenticator. This name is
# used as part of the remaining variable names.
PerlSetVar AuthName sample
# Set the path that will be protected
PerlSetVar samplePath /sample
# Indicate the path to the login page. Be careful, HTML::Mason can
# interfere with proper handling...make sure you know your dependencies.
# See samples and Apache2::AuthCookie for more information.
PerlSetVar sampleLoginScript /sample/samplelogin.pl
# See Apache2::AuthCookie for descriptions of these.
PerlSetVar sampleSatisfy All
PerlSetVar sampleDomain .uoregon.edu
PerlSetVar sampleCache 1
PerlSetVar sampleExpires +2h
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
AuthType Apache2::SiteControl
AuthName sample
sample/apache_sitecontrol.conf view on Meta::CPAN
# Choose a name for the instance of the authenticator. This name is
# used as part of the remaining variable names.
PerlSetVar AuthName sample
# Set the path that will be protected
PerlSetVar samplePath /sample
# Indicate the path to the login page. Be careful, HTML::Mason can
# interfere with proper handling...make sure you know your dependencies.
# See samples and Apache2::AuthCookie for more information.
PerlSetVar sampleLoginScript /sample/samplelogin.pl
# See Apache2::AuthCookie for descriptions of these.
PerlSetVar sampleSatisfy All
PerlSetVar sampleDomain .uoregon.edu
PerlSetVar sampleCache 1
PerlSetVar sampleExpires +2h
AuthType Apache2::SiteControl
AuthName sample
SetHandler perl-script
PerlHandler Apache2::SiteControl->login
</Location>
sample/samplelogin.pl view on Meta::CPAN
my $uri = $r->prev->uri if($r->prev);
# if there are args, append that to the uri
my $args = $r->prev->args if($r->prev);
if ($uri && $args) {
$uri .= "?$args";
}
$uri = "/sample/site/index.html" if !$uri;
my $reason = $r->prev->subprocess_env("AuthCookieReason") if($r->prev);
my $form = <<HERE;
<HTML>
<HEAD>
<TITLE>Enter Login and Password</TITLE>
</HEAD>
<BODY onLoad="document.forms[0].credential_0.focus();">
<FORM METHOD="POST" ACTION="/sample/SampleLogin">
<TABLE WIDTH=60% ALIGN=CENTER VALIGN=CENTER>
<TR><TD ALIGN=CENTER>
( run in 1.540 second using v1.01-cache-2.11-cpan-e9199f4ba4c )