Apache-AppSamurai

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

#!/usr/bin/perl -w

# $Id: Build.PL,v 1.19 2008/05/01 22:35:40 pauldoom Exp $

use strict;
use warnings;
use Module::Build;

# Decide right now if we are shooting for a mod_perl 1.x
# or mod_perl 2.x install.  Defaults to mod_perl 2.x.
# This is to have a proper set of requirements in place
# so CPAN and others will behave.
my @extrareq = ();
if (eval{require mod_perl2;}) {
    push(@extrareq, 'mod_perl2', 1.9922, 'Apache2::Request', 0);
    print STDERR "mod_perl 2 detected: Setting requirements accordingly\n";
} elsif (eval{require mod_perl;}) {
    push(@extrareq, 'mod_perl', 1.07, 'Apache::Request', 0);
    print STDERR "mod_perl 1 detected: Setting requirements accordingly\n";

examples/conf/appsamurai-owa.conf  view on Meta::CPAN

#    AllowOverride None
#    Order allow,deny
#    Allow from all
#</Directory>

# Turn off client proxy requests (All requests mapped by Rewrite)
ProxyRequests Off


# Protect ALL proxied areas (by default)  The actual proxy mapping is
# done with rewrite rules.  (Be careful if you decide to make this 
# a more specific path:  You do not want to expose internal servers!)
# !!! MAKE SURE TO CONFIGURE THE IfDefine SECTION FOR YOUR VERSION !!!
# !!! OF MOD_PERL                                                  !!!
<IfDefine !MODPERL2>
<Directory proxy:*>

  AuthType Apache::AppSamurai

  # IMPORTANT - The auth name MUST match a configured AppSamurai auth name
  AuthName "Owa"

examples/htdocs/login.pl  view on Meta::CPAN

#!/usr/bin/perl
#
# $Id: login.pl,v 1.9 2008/05/03 06:43:24 pauldoom Exp $

# Decide which mod_perl to load
BEGIN {
    use vars qw($MP);
    if (eval{require mod_perl2;}) {
	$MP = 2;
    } else {
	require mod_perl;
	$MP = 1;
    }
}

lib/Apache/AppSamurai/Session.pm  view on Meta::CPAN

 # and very real Apache::AppSamurai::Session::Serialize::CryptBase64
 # serializer.  (This shows the alternate module syntaxes.)

 tie %hash 'Apache::AppSamurai::Session', $id, {
    Store     => 'Thinger::Thing::File',
    Lock      => 'Null',
    Generate  => 'Ranom::Garbage',
    Serialize => 'AppSamurai/CryptBase64'
 };

 # you decide!

=head1 DESCRIPTION

This module is a overload of Apache::Session which allows you to specify the
backing store, locking scheme, ID generator, and data serializer at runtime.
You do this by passing arguments in the usual Apache::Session style (see
SYNOPSIS).  You may use any of the modules included in this distribution, or
a module of your own making.

In addition to the standard Apache::Session setup, this module allows for

lib/Apache/AppSamurai/Session/Generate/HMAC_SHA.pm  view on Meta::CPAN


package Apache::AppSamurai::Session::Generate::HMAC_SHA;
use strict;
use warnings;

use vars qw($VERSION);
$VERSION = substr(q$Revision: 1.9 $, 10, -1);

use Digest::SHA qw(sha256_hex hmac_sha256_hex);

# Instead of adding even more options, I decided to just use SHA-256.
# This is the length in hex digits.
my $length = 64;

sub generate {
    my $session = shift;
    my $server_key = '';

    (exists $session->{args}->{ServerKey}) or die "HMAC session support requires a ServerKey";

    # ServerKey should already be hashed for us

lib/Apache/AppSamurai/Tracker.pm  view on Meta::CPAN

 };
  
 # Postgress backend with session ID passed in directly
 # and Baes64 encoding
 
 tie %hash, 'Apache::AppSamurai::Tracker', $id, {
    Store     => 'Apache::Session::Store::Postgres',
    Lock      => 'Null',
 };
 
 # you decide!

=head1 DESCRIPTION

This module is a subclass of L<Apache::Session|Apache::Session> that can
be used to share non-sensitive information between multiple Apache server
processes.  Its main use is to provide storage of IP login failures and other
non-session data for L<Apache::AppSamurai|Apache::AppSamurai>.

The normal Apache::Session C<Generate> option is not used.  Each tracker
uses a set session ID.  For instance, "IPFailures" is used for the IP failure



( run in 1.654 second using v1.01-cache-2.11-cpan-de7293f3b23 )