Result:
found more than 540 distributions - search limited to the first 2001 files matching your query ( run in 2.934 )


Apache-AuthCookieURL

 view release on metacpan or  search on metacpan

AuthCookieURL.pm  view on Meta::CPAN

package Apache::AuthCookieURL;
use strict;
use mod_perl qw(1.24 StackedHandlers MethodHandlers Authen Authz);
use Apache::Constants qw(:common M_GET REDIRECT MOVED);
use vars qw($VERSION);
use Apache::URI ();
use Apache::Cookie;

use constant DEBUG  => 'AuthCookieURLDebug';

# $Id: AuthCookieURL.pm,v 1.3 2000/11/21 00:46:01 lii Exp $
$VERSION = sprintf '%d.%03d', q$Revision: 1.3 $ =~ /: (\d+)\.(\d+)/;

#======================== NOTE ============================================

### This module is a modification of Ken Williams <ken@forum.swarthmore.edu>
### Apache::AuthCookie apache module.

# Modified July 14, 2000 to handle munged urls and sessions w/o login
# - use cookies or munged urls for sessions
# - can be used with a login script, or without for simple session management
# - Will create sessions without overriding, if you don't care how unique they are.

AuthCookieURL.pm  view on Meta::CPAN

sub recognize_user ($$) {
    my ($self, $r) = @_;
    my $debug = $r->dir_config( DEBUG ) || 0;
    my ($auth_type, $auth_name) = ($r->auth_type, $r->auth_name);
    return unless $auth_type && $auth_name;
    # return unless $r->header_in('Cookie');

    
    my ($cookie) = ($r->header_in( 'Cookie' ) || '') =~ /${auth_type}_$auth_name=([^;]+)/;

    # Get session from URI if not set in a cookie
    # (won't likely be here if this isn't a protected doc)
    $cookie ||= $r->notes( 'URI_Session' ) || '';

AuthCookieURL.pm  view on Meta::CPAN


    } else {

        # Delete error message cookie, if found
        $self->send_cookie( value=>'none', name=>'Reason', expires=>'-1d' )
            if ($r->header_in( 'Cookie' ) || '') =~ /${auth_type}_${auth_name}Reason/;


        $r->log_error("ses_key returned from authen_cred = '$ses_key'" ) if $debug >= 2;


AuthCookieURL.pm  view on Meta::CPAN

  my ($self,$r) = @_;
  my $debug = $r->dir_config( DEBUG ) || 0;
  
  my ($auth_type, $auth_name) = ($r->auth_type, $r->auth_name);
  
  # Send the Set-Cookie header to expire the auth cookie.
  $self->send_cookie(value=>'none', expires=>'-1d');

  return FORBIDDEN;

  # This doesn't seem to work.

AuthCookieURL.pm  view on Meta::CPAN

    $r->log_error( '** In authenticate **' ) if $debug >= 3;
    $r->log_error( "auth_type= '$auth_type'" ) if $debug >= 3;

    # This is a way to open up some documents/directories
    return OK if lc $r->auth_name eq 'none';
    return OK if $r->dir_config('DisableAuthCookieURL');


    # Only authenticate the first internal request
    return OK unless $r->is_initial_req;

AuthCookieURL.pm  view on Meta::CPAN




    ## Check and get session from cookie or URL ##

    # Get the Cookie header. If there is a session key for this realm, strip
    # off everything but the value of the cookie.

    my ($ses_key_cookie) = ($r->header_in( 'Cookie' ) || "") =~ /${auth_type}_$auth_name=([^;]+)/;

    my $cookie = $ses_key_cookie || '';


    # Get session from URI if not set in a cookie

AuthCookieURL.pm  view on Meta::CPAN

    $r->log_error("requested uri = '" . $r->uri . "'" ) if $debug >= 2;



    unless  ($ses_key_cookie) {
        $r->subprocess_env( AuthCookieURLReason => 'no_session_provided' );

    } else {

        # Check and convert the session key into a user
        

AuthCookieURL.pm  view on Meta::CPAN


            $r->connection->auth_type($auth_type);
            $r->connection->user($auth_user);
            $r->log_error("user authenticated as $auth_user. Exiting Authen") if $debug >= 1;

            $r->log_error( "Cookie: '$cookie' and URI_Session: '" . ($r->notes( 'URI_Session' ) || '') ."'") if $debug >= 4; 

            # Clean up the path by redirecting if cookies are in use

            if ( $cookie && $r->notes( 'URI_Session' ) ) {

                my $query = $r->args ? '?' . $r->args : '';
                $query = $r->uri . $query;

                $r->log_error("Cookies are in use -- redirecting to '$query'") if $debug >= 3;

                # prevent the error_document from adding the session back in.
                $r->notes('SESSION', undef );

                $r->header_out( Location => $query );

AuthCookieURL.pm  view on Meta::CPAN


            # Do this even if no cookie was sent -- can't hurt.
            $auth_type->send_cookie( value=>'vanish', expires=>'-1d');
      

            $r->subprocess_env( AuthCookieURLReason => 'bad_session_provided' );
        }
    }


    # Invalid or no session was provided -- send to the login form

AuthCookieURL.pm  view on Meta::CPAN


    $r->log_error( "** In authorize **" ) if $debug >= 3;

    # This is a way to open up some documents/directories
    return OK if lc $r->auth_name eq 'none';
    return OK if $r->dir_config('DisableAuthCookieURL');


    return OK unless $r->is_initial_req; #only the first internal request

    # How to solve the problem of protecting from the root downward?

AuthCookieURL.pm  view on Meta::CPAN

    my ($self, %settings ) = @_;
    my $r = Apache->request();

    my ( $auth_name, $auth_type ) = ( $r->auth_name, $r->auth_type );

    return if $r->dir_config( $auth_name . 'NoCookie' );

    $settings{name} = $settings{name}
                      ? "${auth_type}_$auth_name$settings{name}"
                      : "${auth_type}_$auth_name";

AuthCookieURL.pm  view on Meta::CPAN

    my @deletes = grep { ! defined $settings{$_} } keys %settings;
    delete $settings{$_} for @deletes;

    $settings{path} ||= '/';  # need to do this so will return cookie when url is munged.

    my $cookie = Apache::Cookie->new( $r, %settings );
    $cookie->bake;

    my $debug = $r->dir_config( DEBUG ) || 0;
    $r->log_error('Send cookie: ' . $cookie->as_string ) if $debug >= 3;

AuthCookieURL.pm  view on Meta::CPAN

sub key {
    my $self = shift;
    my $r = Apache->request;
    
    my ( $auth_name, $auth_type ) = ( $r->auth_name, $r->auth_type );
    my ( $ses_key_cookie ) = ($r->header_in( 'Cookie' ) || '') =~ /${auth_type}_$auth_name=([^;]+)/;

    return $ses_key_cookie || $r->notes( 'URI_Session' ) || undef;
}

1;

__END__

=head1 NAME

Apache::AuthCookieURL - Perl Authentication and Authorization
or session management via cookies or URL munging

=head1 SYNOPSIS

In httpd.conf

    # Your module that overrides AuthCookieURL methods
    PerlModule My::AuthCookieURLHandler

    # Or to use simple session generation w/o persistence
    #PerlModule Apache::AuthCookieURL

    ## Some settings -- "Whatever" is set by AuthName ##
    # most can be set within <directory> sections

    # Send expires with cookie

AuthCookieURL.pm  view on Meta::CPAN


    # Or for just session management without a login script
    #PerlSetVar WhateverLoginScript NONE

    # Debugging options
    #PerlSetVar AuthCookieURLDebug 5

    # Disable cookies (only URL based sessions)
    #PerlSetVar WhateverNoCookie 1

    # Define a string that indicates to AuthCookieURL
    # what a session looks like
    # This can only be in main config
    #PerlSetVar SessionPrefix Session-


    # This block enables URL session handling
    PerlTransHandler  Apache::AuthCookieURLHandler->URLsession

    ErrorDocument 302 /MISSING
    ErrorDocument 301 /MISSING
    <Location /MISSING>
        SetHandler perl-script
        PerlHandler Apache::AuthCookieURLHandler->error_document
    </Location>



    <Location /protected>
        AuthType Apache::AuthCookieURLHandler
        AuthName Whatever
        PerlAuthenHandler Apache::AuthCookieURLHandler->authenticate
        PerlAuthzHandler Apache::AuthCookieURLHandler->authorize
        require valid-user
    </Location>


    # provide open access to some areas below
    <Location /protected/open>
        PerlSetVar DisableAuthCookieURL 1
    </Location>

    # or if the entire directory tree was protected
    <Location /images>
        PerlSetVar DisableAuthCookieURL 1
    </Location>


    # Make sure the login script can be run
    <Files login.pl>

AuthCookieURL.pm  view on Meta::CPAN

    </Files>

    # LOGIN is the action defined by the login.pl script

    <Files LOGIN>
         AuthType Apache::AuthCookieURLHandler
         AuthName Whatever
         SetHandler perl-script
         PerlHandler Apache::AuthCookieURLHandler->login
    </Files>

    # Note: If protecting the entire web site (from root down) then
    # the action *must* be C</LOGIN> as the module looks for this string.

    # better to just invalidate the session, of course
    <Files LOGOUT>
         AuthType Apache::AuthCookieURLHandler
         PerlSetVar WhateverLogoutURI /
         AuthName Whatever
         SetHandler perl-script
         PerlHandler Apache::AuthCookieURLHandler->logout
    </Files>

=head1 DESCRIPTION

** Warning: beta software.  This should be used for testing purposes only.
That said, there are a few people using it and I've been using it for a
few months without problem.  The interface may change (or disappear) without notice.
Please report any problems or comments back to Bill Moseley E<lt>moseley@hank.orgE<gt>.

This module is a modification of Ken Williams E<lt>ken@forum.swarthmore.eduE<gt> Apache::AuthCookie.
Please see perldoc Apache::AuthCookie for complete instructions.  As this is intended to be
a drop-in replacement for Apache::AuthCookie you may wish to install and test with Ken's
Apache::AuthCookie before trying AuthCookieURL.

Basically, this module allows you to catch any unauthenticated access and redirect to a
login script that you define.  The login script posts credentials (e.g. username and password)
and your module can then validate and provide a session key.  The session key is sent in a cookie,
and also in a munged URL and a redirect is issued and the process starts all over.

Typically, you will write your own module that will override methods in Apache::AuthCookieURL.
These methods are described completely in Ken's Apache::AuthCookie.  Your methods will be used
to generate and validate session keys.  You can use Apache::AuthCookieURL without overriding
its methods and then AuthCookieURL can be used as a simple session manager.

With this module you should be able to enable session management for an entire site
using E<lt>Location /E<gt>, and then allow access to, say, the images directory, and also require
password access to other locations.  One issue at this point is that the session key is
stripped from URLs in a Trans handler.  So you would need to use cookies to use different
session keys for different parts of your web tree.

Apache::AuthCookieURL adds the following features to Apache::AuthCookie.

=over 4

=item * URL munging

AuthCookieURL.pm  view on Meta::CPAN

information via the environment.

=item * Simple Session Management

If the login script is set to `NONE' with PerlSetVar WhateverLoginScript NONE then
Apache::AuthCookeURL acts like a simple session manager:  your module will provide a new
session key if one is not provided with the request, or if the one provided is invalid.

=item * Really Simple Session Management

Apache::AuthCookieURL provides default authen_cred() and authen_ses_key() methods that
generates a (questionably) random session key.  This means you can use AuthCookieURL
directly without subclassing for really simple session management without any persistence of
session keys.

=back


Unless you are not subclassing this module (and using the default methods provide),
your own module must define two methods: authen_cred() and authen_ses_key(), and then
subclass by including Apache::AuthCookieURL in your module's @ISA array.
Again, please see Apache::AuthCookie for
complete documentation.

=over 4

=item * authen_cred()

AuthCookieURL.pm  view on Meta::CPAN

messages based on that returned session (error) code.

=item * authen_ses_key()

This method's job is to validate and convert a session key into a username and return it.
AuthCookieURL places the returned value into $ENV{REMOTE_USER}.

=back

=head1 CONFIGURATION SETTINGS

AuthCookieURL.pm  view on Meta::CPAN

if you want a setting to override a global setting, then use it within a E<lt>directoryE<gt>,
E<lt>fileE<gt>, or E<lt>locationE<gt> section.

=over 4

=item * AuthCookieURLDebug

Sets the debugging level.  Since some debugging info is generated in the Trans
handler this needs to be set in the main httpd config.  Default is 0.

Example: PerlSetVar AuthCookieURLDebug 5

=item * SessionPrefix

SessionPrefix sets the prefix used by the Trans handler to recognize the session
in the URL (thus needs to be set in the main config), and to create the session ID.

AuthCookieURL.pm  view on Meta::CPAN

Sets where you are redirected after requesting the logout URL (see SYNOPSIS).
Defaults to '/'.  

Example: PerlSetVar WhateverLogoutURI /gone.html

=item * DisableAuthCookieURL

This causes the Authen and Authz handlers to return OK.  In other words,

    <Location /protected/notprotected>
        PerlSetVar DisableAuthCookieURL 1
    </Location>

Allows full access to the notprotected directory.


AuthCookieURL.pm  view on Meta::CPAN


This sets the Login script to be executed when authorization is
required (no valid session key was sent by cookie or URL).  This login script can be a
CGI script, Apache::Registry script, or a mod_perl handler.

If set to `NONE' then AuthCookieURL will be in simple session management mode.
AuthCookieURL-E<gt>login will be called which calls authen_cred() to generate a session key.
authen_cred() should just return a session key without checking the credentials.

If you do not override AuthCookieURL::authen_cred(), then AuthCookieURL::authen_cred()
simply returns this for a session key.

    return time . $$ . int rand $$;

Example: PerlSetVar WhateverLoginScript /login.pl
         PerlSetVar WhateverLoginScript NONE

=item * WhateverNoCookie

Turns off cookies.

Example: PerlSetVar WhateverNoCookie 1

=item * Whatever(Path|Expires|Domain|Secure)

These all control the values sent in cookies.  Path, if used, must be '/' if
using URL-based sessions.

AuthCookieURL.pm  view on Meta::CPAN


=back

=head1 ENVIRONMENT AND NOTES

Apache::AuthCookieURL sets some environment variables and Apache notes:

authen_ses_key() returns a value that is placed in $ENV{REMOTE_USER}.  authen_ses_key()
normally converts the session key into a username.

$ENV{SESSION} contains the current session key

$ENV{AuthCookieURLReason} contains the reason authentication failed.  Either
'no_session_provided' or 'bad_session_provided'.

$r-E<gt>notes( 'URI_Session' ) is the session extracted from the URI

$r-E<gt>notes('Session_prefix') is the prefix used with the session keys, of course.

AuthCookieURL.pm  view on Meta::CPAN

browsers, leak outside your site, and are broken if your pages use absolute links to other
pages on-site.

=head1 TO DO

Apache::AuthCookieURL uses error documents to try to fixup any redirects.  The obvious
example is when a request is made for a directory without a trailing slash and Apache
issues a redirect.  (Actually, AuthCookieURL tries to detect this case and rewrite the URL
before Apache redirects.)  I wish I knew a better way to fixup Location: headers in
redirects without sub-requesting every request.  There's no way to catch a CGI script
or module that might issue a Location: header or REDIRECT.
I guess that's left for Apache 2.0 when all output can be filtered.

=head1 REQUIRED

mod_perl 1.24, Apache::Cookie


=head1 AUTHOR

Bill Moseley E<lt>moseley@hank.orgE<gt> made minor changes to Ken Williams' E<lt>ken@forum.swarthmore.eduE<gt>
Apache::AuthCookie.

Thanks very much to Ken for Apache::AuthCookie.

=head1 VERSION

    $Revision: 1.3 $

=head1 SEE ALSO

L<Apache::AuthCookie>

=cut

 view all matches for this distribution


Apache-AuthDigest

 view release on metacpan or  search on metacpan

API/API.pm  view on Meta::CPAN


    $r->note_basic_auth_failure    $r->note_digest_auth_failure()

    [none]                         $r->compare_digest_response()

see Recipe 13.8 in the mod_perl Developer's Cookbook for a far more
detailed explanantion than will be covered here.

=over 4

=item new()

API/API.pm  view on Meta::CPAN

=head1 EXAMPLE

for a complete example, see the My/DigestAuthenticator.pm file
in the test suite for this package, as well as AuthDigest.pm.
In general, the steps are the same as for Basic authentication, 
examples of which abound on CPAN, the Eagle book, and the Cookbook:

  use Apache::AuthDigest::API;

  sub handler {

API/API.pm  view on Meta::CPAN

This module is free software.  It may be used, redistributed
and/or modified under the same terms as Perl itself.

=head1 HISTORY

This code is derived from the I<Cookbook::DigestAPI> module,
available as part of "The mod_perl Developer's Cookbook".

For more information, visit http://www.modperlcookbook.org/

=cut

 view all matches for this distribution


Apache-AuthTicket

 view release on metacpan or  search on metacpan

lib/Apache/AuthTicket.pm  view on Meta::CPAN

package Apache::AuthTicket;
$Apache::AuthTicket::VERSION = '0.94';
# ABSTRACT: Cookie Based Access and Authorization Module

use strict;
use base qw(Apache::AuthTicket::Base Apache::AuthCookie);
use Apache::Constants;
use Apache::Log;
use MRO::Compat;

sub push_handler {

lib/Apache/AuthTicket.pm  view on Meta::CPAN


=pod

=head1 NAME

Apache::AuthTicket - Cookie Based Access and Authorization Module

=head1 VERSION

version 0.94

lib/Apache/AuthTicket.pm  view on Meta::CPAN


This module provides ticket based access control.  The theory behind this is
similar to the system described in the eagle book.

This module works using HTTP cookies to check if a user is authorized to view a
page.  I<Apache::AuthCookie> is used as the underlying mechanism for managing
cookies.

This module was designed to be as extensible as possible.  Its quite likely
that you will want to create your own subclass of I<Apache::AuthTicket> in
order to customize various aspects of this module (show your own versions of

lib/Apache/AuthTicket.pm  view on Meta::CPAN

This system should be reasonably secure becuase the IP address of the end user
is incorporated into the cryptographic signature. If the ticket were
intercepted, then an attacker would have to steal the user's IP address in
order to be able to use the ticket.  Plus, since the tickets can expire
automatically, we can be sure that the ticket is not valid for a long period of
time.  Finally, by using the I<Secure> mode of I<Apache::AuthCookie>, the
ticket is not passed over unencrypted connections.  In order to attack this
system, an attacker would have to exploit both the MD5 algorightm as well as
SSL. Chances are, by the time the user could break both of these, the ticket
would no longer be valid.

lib/Apache/AuthTicket.pm  view on Meta::CPAN

 Apache::AuthTicket->configure(String auth_name, *Hash config)

Note that when configuring this way you dont prefix the configuration items
with the AuthName value like you do when using PerlSetVar directives.

Note: You must still include I<Apache::AuthCookie> configuration directives in 
httpd.conf when configuring the server this way.  These items include:

    PerlSetVar FooPath /
    PerlSetVar FooDomain .foo.com
    PerlSetVar FooSecure 1

lib/Apache/AuthTicket.pm  view on Meta::CPAN


This directive specifys the number of minutes that tickets should remain
valid for.  If a user exceeds this limit, they will be forced to log in
again.

This should not be confused with the inherited AuthCookie setting C<Expire>,
which is the I<cookie> expiration time.  C<TicketExpires> controls the
expiration of the ticket, not the cookie.

=item B<TicketIdleTimeout>

lib/Apache/AuthTicket.pm  view on Meta::CPAN

This method creats the "login" screen that is shown to the user.  You can
overload this method to create your own login screen.  The log in screen only
needs to contain a hidden field called "destination" with the contents of
I<destination> in it, a text field named I<credential_0> and a password field
named I<credential_1>.  You are responsible for sending the http header as well
as the content.  See I<Apache::AuthCookie> for the description of what each of
these fields are for.

I<action> contains the action URL for the form.  You must set the action of
your form to this value for it to function correctly.

I<Apache::AuthTicket> also provides a mechanism to determine why the login for
is being displayed.  This can be used in conjunction with
I<Apache::AuthCookie>'s "AuthCookieReason" setting to determine why the user is
being asked to log in.  I<Apache::AuthCookie> sets
$r->prev->subprocess_env("AuthCookieReason") to either "no_cookie" or
"bad_cookie" when this page is loaded.  If the value is "no_cookie" then the
user is being asked to log in for the first time, or they are logging in after
they previously logged out.  If this value is "bad_cookie" then
I<Apache::AuthTicket> is asking them to re-login for some reason.  To determine
what this reason is, you must examine

lib/Apache/AuthTicket.pm  view on Meta::CPAN

=head1 CREDITS

The idea for this module came from the Ticket Access system in the eagle book,
along with several ideas discussed on the mod_perl mailing list.

Thanks to Ken Williams for his wonderful I<Apache::AuthCookie> module, and for
putting in the necessary changes to I<Apache::AuthCookie> to make this module
work!

=head1 SEE ALSO

L<perl>, L<mod_perl>, L<Apache>, L<Apache::AuthCookie>

=head1 SOURCE

The development version is on github at L<http://github.com/mschout/apache-authticket>
and may be cloned from L<git://github.com/mschout/apache-authticket.git>

 view all matches for this distribution


Apache-AuthTkt

 view release on metacpan or  search on metacpan

AuthTkt.pm  view on Meta::CPAN

    ignore_ip                   => 0,
    require_ssl                 => 0,
    cookie_secure               => 0,
);
my %BOOLEAN = map { $_ => 1 } qw(
    TKTAuthGuestLogin TKTAuthIgnoreIP TKTAuthRequireSSL TKTAuthCookieSecure
);
# Default TKTAuthDomain to host part of HTTP_HOST, or SERVER_NAME
($DEFAULTS{TKTAuthDomain}) = split /:/, $ENV{HTTP_HOST} || '';
$DEFAULTS{TKTAuthDomain} ||= $ENV{SERVER_NAME};
my %ATTR = map { $_ => 1 } qw(

AuthTkt.pm  view on Meta::CPAN

        }
        elsif (defined $merge{$directive}) {
            $merge{$directive} =~ s/^\s+//;
            $merge{$directive} =~ s/\s+$//;
        }
        if ($directive eq 'TKTAuthCookieExpires' || $directive eq 'TKTAuthTimeout') {
          $self->{$_} = $self->convert_time_seconds($merge{$directive});
        }
        # Don't allow TKTAuthDebug to turn on debugging here
        elsif ($directive ne 'TKTAuthDebug') {
          $self->{$_} = $merge{$directive};

AuthTkt.pm  view on Meta::CPAN


=over 4

=item cookie_name

Cookie name. Should match the TKTAuthCookieName directive, if you're
using it. Default: $at->cookie_name, or 'auth_tkt'.

=item cookie_domain

Cookie domain. Should match the TKTAuthDomain directive, if you're
using it. Default: $at->domain.

=item cookie_path

Cookie path. Default: '/'.

=item cookie_secure

Flag whether to set the 'secure' cookie flag, so that the cookie is 
returned only in HTTPS contexts. Default: $at->require_ssl, or 0.

 view all matches for this distribution


Apache-AuthTypeKey

 view release on metacpan or  search on metacpan

lib/Apache/AuthTypeKey.pm  view on Meta::CPAN

BEGIN {
    require base;
    if (MP2) {
        require Apache2::Const;
        Apache2::Const->import(-compile => qw( SERVER_ERROR ));
        base->import(qw( Apache2::AuthCookie ));
    } else {
        require Apache::Constants;
        Apache::Constants->import(qw( SERVER_ERROR ));
        base->import(qw( Apache::AuthCookie ));
    }
}

sub authen_cred {
    my($self, $r, @cred) = @_;

lib/Apache/AuthTypeKey.pm  view on Meta::CPAN

I<https://www.typekey.com/t/typekey/register>, then fill out the Preferences
form to include the URI of your application. Specifically, this URI should be
the URI for the I</login-protected> area above, because that's the URI that
TypeKey will return to after a user logs in.

I<Apache::AuthTypeKey> is a subclass of I<Apache::AuthCookie>, so it inherits
all of that module's cookie-handling and authorization code. It also inherits
all of that module's configuration settings and options.

=head2 Authentication

Authentication is handled for you through TypeKey, and cookie handling is
handled by I<Apache::AuthCookie>. The value of the cookie will be the string
returned from TypeKey, including the username, email address, name, and a
DSA signature on those values, preventing users from forging the cookie.

=head2 Login Screen

lib/Apache/AuthTypeKey.pm  view on Meta::CPAN

that you'll be providing should be just a simple page linking people to that
login screen, along with your TypeKey token and return URI. An example login
screen is in F<eg/login.pl>, but you'll probably wish to customize the HTML,
as it's fairly plain.

The login script functionality is inherited from I<Apache::AuthCookie>, so
it's implemented as a script that you must configure in your I<httpd.conf>
or I<.htaccess>. For example:

    PerlSetVar TypeKeyLoginScript /login.pl

If you'd rather use a different mechanism for your login screen, you can
subclass I<Apache::AuthTypeKey> and override the I<login_form> method. See
the L<Apache::AuthCookie> documentation for more details.

=head2 Authorization

I<Apache::AuthTypeKey>--coupled with TypeKey--will handle all of the
authentication for you, telling you whether someone is a valid TypeKey user.

lib/Apache/AuthTypeKey.pm  view on Meta::CPAN


If you'd like to do something more complex, like look up valid TypeKey
usernames in a database listing authorized users, you can subclass
I<Apache::AuthTypeKey> and override the I<authorize> method. Note that
I<Apache::AuthTypeKey> doesn't actually provide its own I<authorize>
method anyway--it merely inherits I<Apache::AuthCookie-E<gt>authorize>.

=back

=head1 LICENSE

lib/Apache/AuthTypeKey.pm  view on Meta::CPAN

Except where otherwise noted, I<Apache::AuthTypeKey> is Copyright 2004 Six
Apart Ltd, cpan@sixapart.com. All rights reserved.

=head1 SEE ALSO

L<Apache::AuthCookie>, L<Authen::TypeKey>

=cut

 view all matches for this distribution


Apache-Authen-Generic

 view release on metacpan or  search on metacpan

Generic.pm  view on Meta::CPAN

    # cgi script
    use Apache::Authen::Generic;
    my $auth_obj = Apache::Authen::Generic->new;
    if (&check_login($user, $pwd)) {
        my $cookie = $auth_obj->($data, $key);
        print "Set-Cookie: $cookie\n";
        print "Location: $redirect_url\n";
        print "\n";
    } else {
        &handle_invalid_password()
    }

Generic.pm  view on Meta::CPAN


=head3 generic_auth_cookie_name

 This is the name of the cookie that will be used to verify
 authentication.  This must match the name passed to the
 generateAuthCookie() method when using a CGI script for the
 login process.

=head3 generic_auth_ref_url_var

 This is the name of the field the handler will use to pass the

Generic.pm  view on Meta::CPAN

 trying to access when prompted with the login page.

=head3 generic_auth_set_cookie_env

 If this is set to a true value, and the first argument passed to
 the generateAuthCookie() method is a hash, those values will be
 available to your CGI scripts as environment variables whose
 names are the keys of the hash prefixed with the cookie name (as
 set by generic_auth_cookie_name) and an underscore.

=head1 METHODS

Generic.pm  view on Meta::CPAN

        return $self;
    }

=pod

=head2 generateAuthCookie($data, $key, $cookie_params, $cookie_name)

 This method is used to generate the authentication cookie from a
 CGI script.  The return value is the value to set for the header
 Set-Cookie without the end of line sequence, e.g.,

     my $cookie = $auth_obj->($data, $key);
     print "Set-Cookie: $cookie\n";
     print "Location: $redirect_url\n";
     print "\n";

 The value for $key must be the same value assigned to
 generic_auth_cipher_key in the webserver configuration.

Generic.pm  view on Meta::CPAN

 names are the keys of the hash prefixed with the cookie name (as
 set by generic_auth_cookie_name) and an underscore.

=cut
    # This method is normally to be run from a CGI script
    sub generateAuthCookie {
        my ($self, $data, $key, $cookie_params, $cookie_name) = @_;
        $cookie_params = {} unless ref($cookie_params) eq 'HASH';
        $cookie_name = $self->getAuthCookieName if $cookie_name eq '';

        my $array = [ 1, $data ];

        # this value is encoded -- should be safe for cookies
        my $val = $self->encrypt($array, undef, $key);

Generic.pm  view on Meta::CPAN

    }

    sub checkAlreadyAuthenticated {
        my ($self, $req) = @_;
        
        my $cookies = $self->getCookies($req);

        my $cookie_name = $self->getAuthCookieName($req);
        my $cipher_val = $$cookies{$cookie_name};
        return undef if $cipher_val eq '';

        my $data = $self->decrypt($cipher_val, $req);
        unless (ref($data) eq 'ARRAY' and scalar(@$data) > 0) {

Generic.pm  view on Meta::CPAN

        }

        return 1;
    }

    sub getAuthCookieName {
        my ($self, $req) = @_;
        if ($req) {
            my $cookie_name = $req->dir_config('generic_auth_cookie_name');
            return $cookie_name unless $cookie_name eq '';
        }

Generic.pm  view on Meta::CPAN

    sub getCipher {
        my ($self, $req) = @_;
        return 'Crypt::Rijndael';
    }

    sub getCookies {
        my ($self, $req) = @_;
        my $headers = $req->headers_in;
        return $self->parseCookieData($$headers{Cookie});
    }

    sub parseCookieData {
        my ($self, $cookie_data) = @_;
        
        my $results = {};
        my(@pairs) = split("; ", $cookie_data);
        foreach my $key_value (@pairs) {

 view all matches for this distribution


Apache-AuthenNTLM

 view release on metacpan or  search on metacpan

AuthenNTLM.pm  view on Meta::CPAN


=head1 SEE ALSO

An implementation of this module which uses cookies to cache the session.

Apache-AuthCookieNTLM - Leo Lapworth
http://search.cpan.org/~llap/Apache-AuthCookieNTLM/

=head1 AUTHOR

G. Richter (richter@dev.ecos.de)
Ported by Shannon Eric Peevey (speeves@unt.edu)

 view all matches for this distribution


Apache-AuthenSecurID

 view release on metacpan or  search on metacpan

Auth/Auth.pm  view on Meta::CPAN

   # get ace_initd config directives
   my $ace_initd_server  = $r->dir_config("ace_initd_server") || "localhost";
   my $ace_initd_port  = $r->dir_config("ace_initd_port") || 1969;

   # grab apache session cookie
   my ( $session_id ) = ( ($r->header_in("Cookie") || "") =~
                /Apache=([^;]+)/);

   my $client = IO::Socket::INET->new ( PeerAddr   =>      $ace_initd_server,
                                        PeerPort   =>      $ace_initd_port,    
                                        Proto      =>      'udp' );

Auth/Auth.pm  view on Meta::CPAN

	my $uri = $$params{'a'};
	my $time = time ();

if ( $result == 0 ) {

	my $auth_cookie = $r->dir_config("AuthCookie") || "SecurID";
	my $auth_user_cookie = $r->dir_config("AuthUserCookie") || "SecurID_User";
	my $crypt_cookie = $crypt->encrypt_hex ( "$time:$username" );
	$r->headers_out->add("Set-Cookie" => $auth_user_cookie . "=" .
		$username . "; path=" . "/");
	$r->headers_out->add("Set-Cookie" => $auth_cookie . "=" .
		$crypt_cookie . "; path=" . "/");

	$uri = $crypt->decrypt_hex ( $uri );

	# success

Auth/Auth.pm  view on Meta::CPAN

<Location /path/of/authentication/handler>
   SetHandler perl-script
   PerlHandler Apache::AuthenSecurID::Auth

   PerlSetVar AuthCryptKey Encryption_Key
   PerlSetVar AuthCookie Name_of_Authentication_Cookie
   PerlSetVar AuthUserCookie Name_of_Username_Authentication_Cookie
   PerlSetVar AuthCookiePath /path/of/authentication/cookie
   PerlSetVar AuthApacheCookie Apache_Cookie
   PerlSetVar ace_initd_server name.of.ace.handler.server.com
   PerlSetVar ace_initd_port 1969
</Location>

=head1 DESCRIPTION

Auth/Auth.pm  view on Meta::CPAN

is redirected to this handler if the authentication cookie does not
exist or is no longer valid.  The handler will prompt for username and 
passcode.  It will then construct and encrypt a UDP packet and send it to 
the Ace request daemon.  This is necessary since libsdiclient.a needs to 
persist for NEXT TOKEN MODE and SET PIN MODE.  If the authentication is 
valid an encrypted Authentication Cookie is set and the request is redirected 
to the originating URI.  If the user needs to enter NEXT TOKEN or set their 
PIN they will be prompted to do so and if valid the request is then redirected 
to the originating URI.


Auth/Auth.pm  view on Meta::CPAN


The Blowfish key used to encrypt and decrypt the authentication cookie. 
It defaults to F<my secret> if this variable is not set.

=item *
AuthCookie

The name of the of cookie to be set for the authentication token.  
It defaults to F<SecurID> if this variable is not set.

=item *
AuthUserCookie

The name of the of cookie that contains the value of the persons username
in plain text.  This is checked against the contents of the encrypted cookie
to verify user.  The cookie is set of other applications can identify 
authorized users.  It defaults to F<SecurID_User> if this variable is not set.

=item *
AuthCookiePath

The path of the of cookie to be set for the authentication token.  
It defaults to F</> if this variable is not set.

=item *
AuthApacheCookie

The name of the mod_usertrack cookie.  The mod_usertrack module must be
compile and enabled in order to track user sessions.  This is set by the
CookieName directive in httpd.conf.  It defaults to F<Apache> if this variable 
is not set.

=item *
ace_initd_server

 view all matches for this distribution


Apache-AutoLogin

 view release on metacpan or  search on metacpan

AutoLogin.pm  view on Meta::CPAN


use Apache::Constants qw(OK DECLINED SERVER_ERROR);
use Crypt::Rijndael;
use MIME::Base64;
use Digest::MD5 qw(md5_hex md5);
use Apache::Cookie;
use Apache::Request;
use Apache::Log;

our $VERSION = '0.1';

AutoLogin.pm  view on Meta::CPAN

    $client_identifier=$client_identifier."-".md5_hex($r->headers_in->get('User-Agent')).
                "-".md5_hex($r->headers_in->get('Host'));
    
    ## Now read the configuration variable from the httpd.conf
    
    my $cookie_lifetime=$r->dir_config('AutoLoginCookieLifetimeInDays');
    my $encryption_key=$r->dir_config('AutoLoginEncryptionKey');
    my $logout_uri=$r->dir_config('AutoLoginLogoutPage');
    my $auth_name=$r->dir_config('AutoLoginAuthName');
    
    ## lets make an md5 hash out of the encryption key.

AutoLogin.pm  view on Meta::CPAN

    
    $log->info("header $user from $client_identifier");
    
    # Look for any cookies
    
    my %cookiejar = Apache::Cookie->new($r)->parse;
    
    
    ## If the user has called the predefined logout page,
    ## invalidate the cookie
    if ($r->uri() eq $logout_uri)

AutoLogin.pm  view on Meta::CPAN

            $temp_key2.=int(rand(10));
            $temp_key3.=int(rand(10));
            ++$i;
        }
        
        setCookie($r,$temp_key2,$temp_key3,0,1,$temp_key);
       
        $r->uri($logout_uri);
        return OK;
    }
    

AutoLogin.pm  view on Meta::CPAN

    
    unless ($cookiejar{$auth_name}) {
        
        $log->info("Client $client_identifier has no cookie");
    
        setCookie($r,$user,$password,$client_identifier,$cookie_lifetime,$encryption_key);
        
        # DECLINED zur?ckgeben, damit Apache weitermacht.
        return DECLINED;
    }
    

AutoLogin.pm  view on Meta::CPAN

        
        # Check if the cookie hasn't expired
        
        if (time()>$c_date)
        {
            $log->info("Cookie has expired");
            setCookie($r,$user,$password,$client_identifier,$cookie_lifetime,$encryption_key);
            return DECLINED;
        }
        
        # Check if the cookie comes from the host it was issued to
        
        if ($client_identifier ne $c_client_ip)
        {
            $log->info("Cookie for $c_user has not been set for $client_identifier but for $c_client_ip");
            setCookie($r,$user,$password,$client_identifier,$cookie_lifetime,$encryption_key);
            return DECLINED;
        }
    }
    else
    {

AutoLogin.pm  view on Meta::CPAN

    }
    
    # If the client sent any http authentication credentials lets write them to a cookie
    
    if ($user ne '' && $password ne '') {
        setCookie($r,$user,$password,$client_identifier,$cookie_lifetime,$encryption_key);
    }
    
    # Else write the credentials within the cookie into the http header
    else {
        # But only if there IS something in the cookie!

AutoLogin.pm  view on Meta::CPAN

    # Return DECLINED
    return DECLINED;
}

## sets the cookie
sub setCookie {
    
    my ($r,$user,$password,$client_identifier,$cookie_lifetime,$encryption_key)=@_;
    my $auth_name=$r->dir_config('AutoLoginAuthName');
    my $log=$r->server->log;

    my $auth_cookie = Apache::Cookie->new ($r,
                                       -name => $auth_name,
                                       -value => {Basic => encode_base64(encrypt_aes(join (":",$user,$password,$client_identifier,(time()+60*60*24*$cookie_lifetime)),$encryption_key))},
                                       -path => "/",
                                       -expires => "+".$cookie_lifetime."d"
                                      );

AutoLogin.pm  view on Meta::CPAN

        PerlModule Apache::AutoLogin
        PerlAccessHandler Apache::AutoLogin
        
        # Set the lifetime of the cookie in days
        
        PerlSetVar AutoLoginCookieLifetimeInDays "3"
        
        # The encryption key can have any length, but the longer the better
        
        PerlSetVar AutoLoginEncryptionKey "abcdefghijklmnopqrstuvwxyz123456"
        

AutoLogin.pm  view on Meta::CPAN

  # can be viewed by the client without authentication!
  
  <Location /logout.php>
        PerlModule Apache::AutoLogin
        PerlAccessHandler Apache::AutoLogin
        PerlSetVar AutoLoginCookieLifetimeInDays "3"
        ## Anything as a key, is not important, cause it will by a random key
        PerlSetVar AutoLoginEncryptionKey "abcdefghijklmnopqrstuvwxyz123456"
        PerlSetVar AutoLoginLogoutPage "/logout.php"
        PerlSetVar AutoLoginAuthName "AutoLogin rulez"

AutoLogin.pm  view on Meta::CPAN


=head1 Apache configuration directives

All directives are passed in PerlSetVar.
        
=head2 AutoLoginCookieLifetimeInDays "3"

    Lifetime of the cookie in days.

=head2 AutoLoginEncryptionKey "abcdefghijklmnopqrstuvwxyz123456"

 view all matches for this distribution


Apache-AxKit-Plugin-AddXSLParams-Request

 view release on metacpan or  search on metacpan

Request.pm  view on Meta::CPAN

package Apache::AxKit::Plugin::AddXSLParams::Request;

use strict;
use Apache::Constants;
use Apache::Cookie;
use Apache::Request;
use Apache::URI;
use vars qw($VERSION);
$VERSION = '1.02';

Request.pm  view on Meta::CPAN

    # HTTP Headers
    if ( grep { $_ eq 'HTTPHeaders' } @allowed_groups ) {
        my $headers = $r->headers_in();
        foreach my $h ( keys( %{$headers} ) ) {
            #warn "Processing header " .  lc( $h ) . " = " . $headers->{$h} . " \n";
            if ( $h eq 'Cookie' ) {
                my $cookies = Apache::Cookie::parse( $headers->{$h} );
                foreach my $oreo ( keys( %{$cookies} ) ) {
                    $cgi->parms->set('request.cookie.' . $oreo => $cookies->{$oreo}->value ) if defined( $cookies->{$oreo}->value );

                }
            }
        
            $cgi->parms->set('request.headers.' . lc( $h ) => $headers->{$h});
        }
    }
            
    # Allow 'em to get Cookies header without all the other headers as an alternative
    elsif ( grep { $_ eq 'Cookies' } @allowed_groups ) {
        my $cookies = Apache::Cookie::parse( $r->header_in('Cookie') );
        foreach my $oreo ( keys( %{$cookies} ) ) {
            $cgi->parms->set('request.cookie.' . $oreo => $cookies->{$oreo}->value ) if defined( $cookies->{$oreo}->value );

        }
    }  

Request.pm  view on Meta::CPAN

The headers sent during a request vary somewhat from client to client; this
group will contain I<all> the headers returned by the request object's
headers_in() method using the convention: request.headers.I<fieldname> where
I<fieldname> is name of the given HTTP header field, forced to lower case.

If any HTTP Cookies are found in the headers, they will be parsed and values available as XSLT
params using the naming convention: request.cookies.I<yourcookiename>. See the B<Cookies> group
below for an alternative way to access cookies.

More common headers include:

=over 4

Request.pm  view on Meta::CPAN

  <xsl:param name="request.headers.accept-language"/>
  <xsl:param name="request.headers.host"/>
  <xsl:param name="request.headers.user-agent"/>
  <xsl:param name="request.headers.referer"/>

=head1 B<Cookies>

Provides an I<alternative> way to access the HTTP Cookies header for those folks
that want to get at the cookie data but don't want to pull in all of the other
HTTP headers.

B<Param Prefix>: request.cookies.*

B<Implemented Fields>:

Cookie values are made available as params using the convention: request.cookies.I<yourcookiename>

B<Examples>:

  <xsl:param name="request.cookies.oreo"/>
  <xsl:param name="request.cookies.chocolate-chip"/>

Request.pm  view on Meta::CPAN


=item * libapreq

=item * Apache::Request

=item * Apache::Cookie

=item * Apache::URI

=item * AxKit (1.5 or greater)

Request.pm  view on Meta::CPAN


Kip Hampton, khampton@totalcinema.com

=head1 SEE ALSO

AxKit, Apache::Request, libapreq, Apache::Cookie, Apache::URI

=cut

 view all matches for this distribution


Apache-AxKit-Plugin-Session

 view release on metacpan or  search on metacpan

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

    use Apache::Constants qw(:common :response);
    our $VERSION = 1.00;
}

#######################################################
# this code comes from Apache::AuthCookieURL (modified)
#

use mod_perl qw(1.24 StackedHandlers MethodHandlers Authen Authz);
use Apache::Constants qw(:common M_GET REDIRECT MOVED);
use Apache::URI ();
use Apache::Cookie;
use URI::Escape;
use URI;

# store reason of failed authentication, authorization or login for later retrieval
#======================

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

            $or->pnotes('COOKIES',{}) unless $or->pnotes('COOKIES');
	    return;
    }

    my %cookies;
    my %cookiejar = Apache::Cookie->new($r)->parse;
    foreach (sort keys %cookiejar) {
        my $cookie = $cookiejar{$_};
        $cookies{$cookie->name} = $cookie->value;
    }
    $or->pnotes('COOKIES',\%cookies);

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

    $self->debug(3,"======= send_cookie(".join(',',@_).")");
    my $r = Apache->request();
    my $auth_name = $r->auth_name || 'AxKitSession';
    my $auth_type = $r->auth_type || __PACKAGE__;

    return if $r->dir_config($auth_name.'NoCookie');

    $settings{name} = "${auth_type}_$auth_name".($settings{name}||'');

    for (qw{Path Expires Domain Secure}) {
    my $s = lc();

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN


    # need to do this so will return cookie when url is munged.
    $settings{path} ||= '/';
    $settings{domain} ||= $r->hostname;

    my $cookie = Apache::Cookie->new($r, %settings);
    $cookie->bake;
    $r->err_headers_out->add("Set-Cookie" => $cookie->as_string);

    $self->debug(3,'Sent cookie: ' . $cookie->as_string);
}
# ____ End of send_cookie ____

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

    my ($self,$r, $location) = @_;
    $self->debug(3,"======= logout(".join(',',@_).")");
    my $auth_name = $r->auth_name || 'AxKitSession';
    my $auth_type = $r->auth_type || __PACKAGE__;

    # Send the Set-Cookie header to expire the auth cookie.
    $self->send_cookie(value=>'');

    $r->no_cache(1) unless $r->dir_config($auth_name.'Cache');
    $location = $r->dir_config($auth_name.'LogoutURI') if @_ < 3;
    $r->notes('SESSION_URLPREFIX',''); # so error doc doesn't fixup.

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

                $r->notes('SESSION_URLPREFIX')) {

                my $uri = $r->uri;
                $uri .= '?'.$r->args if $r->args;
                my $query = $self->save_params($uri);
                $self->debug(3,"URL and Cookies are in use - redirecting to '$query'");

                # prevent the error_document from adding the session back in.
                $r->notes('SESSION_URLPREFIX', undef );

                return $self->external_redirect($query);

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN


$redirect_location ||= '/redirect';
#__PACKAGE__->initialize_url_sessions($redirect_location) if ($Apache::Server::Starting);

#
# end of AuthCookieURL.pm
#######################################################

sub has_permission {
    my ($r, $attr_target) = @_;
    $attr_target = URI->new_abs($attr_target, $r->uri);

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

    $self->debug(4,"-------- $requirement returned $rc");
    return FORBIDDEN if $rc == OK;
    return OK;
}

# methods for retrieving permissions (get_permissions is in AuthCookieURL)

sub default_unpack_requirement {
    my ($self, $req, $args) = @_;
    return [ $req => [ split(/\s+/,$args) ] ];
}

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

        push @rc, [ $$req[0], $self->$sub($req) ];
    }
    $self->set_permissions($r,@rc);
}

# overriding AuthCookieURL to implement OR style require handling
sub authorize ($$;$) {
    my ($self, $r, $reqs) = @_;
    my $auth_type = $self;
    $self->debug(3,"------- authorize(".join(',',@_).")");

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

for each request, AOL customers for example. There are several values for you
to choose: 0 = no check; 1 = use numeric IP address or X-Forwarded-For, if present;
2 = use numeric IP address with last part stripped (/24 subnet); 3 = use
numeric IP address

=head2 Cookie options

Look at L<Apache::Cookie>. You'll quickly get the idea:

    PerlSetVar AxKitSessionPath /
    PerlSetVar AxKitSessionExpires +1d
    PerlSetVar AxKitSessionDomain some.domain
    PerlSetVar AxKitSessionSecure 1

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

since the default value is best: it keeps the cookies until the user closes his
browser.

Disable cookies: (force URL-encoded sessions)

    PerlSetVar AxKitSessionNoCookie 1

=head2 Internal options

DANGER! Do not fiddle with these unless you know what you are doing.

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

WARNING: This version is for AxKit 1.7 and above!

This module is an authentication and authorization handler for Apache, designed specifically
to work with Apache::AxKit. It should be generic enough to work without it as well, only
much of its comfort lies in a separate XSP taglib which is distributed alongside this module.
It combines authentication and authorization in Apache::AuthCookieURL style with session management
via one of the Apache::Session modules. It should even work with Apache::Session::Counted. See those
manpages for more information, but be sure to note the differences in configuration!

In addition to Apache::AuthCookieURL, you get:

=over 4

=item * session data in $r->pnotes('SESSION')

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

except SessionPrefix, which must be a global setting.

=over 4

=item * SessionPrefix, AxKitSessionCache, AxKitSessionLoginScript, AxKitSessionLogoutURI,
AxKitSessionNoCookie, AxKitSession(Path|Expires|Domain|Secure)

These settings are similar to Apache::AuthCookieURL. Some of them are very advanced
and probably not needed at all. Some may be broken by now. Please only use the documented
variables shown in the synopsis.

=item * AxKitSessionExpire

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN

browsers, leak outside your site, and can be broken if your pages use absolute links to other
pages on-site (but there is HTTP Referer: header tracking for this case). Keep this in mind.

The redirect handler tries to catch the case of external redirects by changing them into
self-refreshing pages, thus removing a possibly sensitive http referrer header. This
won't work from mod_perl, so use Apache::AuthCookieURL's fixup_redirect instead. If you are
adding hyperlinks to your page, change http://www.foo.com to /redirect?url=http://www.foo.com

=head1 REQUIRED

Apache::Session, AxKit 1.7, mod_perl 1.2x

lib/Apache/AxKit/Plugin/Session.pm  view on Meta::CPAN


1.00

=head1 SEE ALSO

L<Apache::AuthCookie>, L<Apache::AuthCookieURL>, L<Apache::Session>,
L<Apache::Session::File>, L<Apache::Session::Counted>, L<AxKit::XSP::Session>,
L<AxKit::XSP::Auth>, L<AxKit::XSP::Globals>, L<Tie::SymlinkTree>

=cut

 view all matches for this distribution


Apache-CacheContent

 view release on metacpan or  search on metacpan

CacheContent.pm  view on Meta::CPAN


=over 15

=item Note:

This code is derived from the I<Cookbook::CacheContent> module,
available as part of "The mod_perl Developer's Cookbook"

=for html (see <a href="http://www.modperlcookbook.org">http://www.modperlcookbook.org</a>)

=back

CacheContent.pm  view on Meta::CPAN


=head1 SEE ALSO

The example mod_perl method handler C<CacheWeather>.

The mod_perl Developer's Cookbook

=for html <A href="http://www.modperlcookbook.org">http://www.modperlcookbook.org</a>

=head1 HISTORY

This code is derived from the I<Cookbook::CacheContent> module,
available as part of "The mod_perl Developer's Cookbook".

For more information, visit 

  http://www.modperlcookbook.org/

 view all matches for this distribution


Apache-Centipaid

 view release on metacpan or  search on metacpan

Centipaid.pm  view on Meta::CPAN

use Apache::Constants qw(OK REDIRECT AUTH_REQUIRED DECLINED FORBIDDEN DECLINED SERVER_ERROR);
use Apache::File;
use IO::Socket;
use Net::hostent;
use DBI;
use CGI::Cookie;



use strict;

Centipaid.pm  view on Meta::CPAN

my $line;
my $and;


#cookie information
my %cookies = CGI::Cookie->parse($r->header_in('Cookie'));
my $cookie;
if ( $cookies{$cookie_name} =~ /$cookie_name=([^;]+)/ ) { $cookie = $1; }

	

Centipaid.pm  view on Meta::CPAN

							)
						};
				my $sth =  $dbh->do("$sql");

				# set the cookie so we do not call the server again..
				my $str = CGI::Cookie->new(-name => "$cookie_name",
							   -path=> "$access",
							   -domain => "$domain",
							   -value => "$rcpt",
							   -expires => "+".$duration."s");

				$r->err_headers_out->add('Set-Cookie' => $str);	
				$r->content_type('text/html');
				$r->header_out(Location =>"$uri");
				return REDIRECT;
			}# if paid == amount
			

Centipaid.pm  view on Meta::CPAN

		return OK;
	}		
	
	
	#if we are at this stage, then the cookie is not valid or not found and we should remove it.. 
	my $str = CGI::Cookie->new(-name => "$cookie_name",
					   -path=> "$access",
					   -domain => "$domain",
					   -value => "",
					   -expires => "-".$duration."s");

	$r->err_headers_out->add('Set-Cookie' => $str);	
	need_to_pay($r);
	
		
	
} else {

Centipaid.pm  view on Meta::CPAN

 </directory>


=head1 REQUIRES

Perl5.004_04, mod_perl 1.15, IO::Socket, Net::hostent, DBI, DBD, DBD::mysql, CGI::Cookie;


=head1 DESCRIPTION

B<Apache::Centipaid> is a mod_perl Authentication handler used in 

 view all matches for this distribution


Apache-ChooseLanguage

 view release on metacpan or  search on metacpan

ChooseLanguage.pm  view on Meta::CPAN

#                                    #
######################################


use strict;
use CGI::Cookie ();
use Apache::Constants qw(:common);

our $VERSION = '1.02';

sub handler
{
    my $r = shift;
    my $uri = $r->uri;

    my $root = $r->dir_config('ChooseRoot');
    my $Cookie = $r->dir_config('ChooseCookie') or 0;

    return DECLINED unless( $uri eq $root or $Cookie );

    my $Browser = $r->dir_config('ChooseBrowser') or 1;
    my $Fuzzy = $r->dir_config('ChooseFuzzy') or 1;
    my $NoCache = $r->dir_config('ChooseNoCache') or 0;

    my %indexes = split /\s*(?:=>|,)\s*/s, $r->dir_config('ChooseIndexes');

    if( $Cookie )
    {
	my $language = "";
	my $setCookie = 0;
	
	while (  my ($key, $value) = each %indexes )
	{
	    if ( $uri eq $value )
	    {
		$setCookie = 1;
		$language = $key;
		last;
	    }
	}
	
	my %cookies = CGI::Cookie->parse($r->header_in('Cookie'));

	my $lang_cookie = $cookies{'LANGUAGE'}->value if defined $cookies{'LANGUAGE'};
	
	if ( $setCookie and $language ne $lang_cookie )
	{
	    my $domain = $r->dir_config('ChooseDomain')
		or warn "Apache::Choose : No domain for cookie\n";
	    my $expire = $r->dir_config('ChooseExpire') || "+1M";
	    
	    my $newcookie = CGI::Cookie->new( -name => 'LANGUAGE',
					      -value => $language,
					      -domain => $domain,
					      -path => '/',
					      -expires => $expire);
	    
	    $r->header_out( 'Set-Cookie' => $newcookie );
	    return DECLINED;
	}
	elsif ( $uri eq $root and $lang_cookie )
	{
	    $r->no_cache($NoCache);

ChooseLanguage.pm  view on Meta::CPAN


  # Behaviour flags ( 0 = no, 1 = yes )
  PerlSetVar	ChooseBrowser	1 # Use the browser's language preference
  PerlSetVar	ChooseFuzzy	1 # Use fuzzy language selection
          	           	  # ( treat en-US as en, fr-CA as fr )
  PerlSetVar	ChooseCookie	1 # Set a cookie to remember the user choice
  PerlSetVar    ChooseNoCache   1 # Prevent the browser from caching "ChooseRoot"

  # Cookie settings
  PerlSetVar	ChooseDomain	"www.yourdomain.com"
  PerlSetVar	ChooseExpire	"+1M"

  # Root URL for this handler to react
  PerlSetVar	ChooseRoot	"/" # This URL has to be typed exactly for

ChooseLanguage.pm  view on Meta::CPAN


Setting ChooseNoCache to a true value will prevent the broser from caching the pages sent by this handler.  If unset, the client may see the previously selected page after choosing a different one.

If using cookies, you have to manually set your domain and expiration data.  The language cookie will be sent when:
  1- A page refered by the ChooseIndexes PerlVar is accessed
  2- The ChooseCookie PerlVar is set
  3- This cookie dosen't already exists and contain the correct value

Both index (language choice and language-specific) should be relative to your document root, since apache's translation handler will do it's job after this one.

=head1 AUTHOR

 view all matches for this distribution


Apache-ClearSilver

 view release on metacpan or  search on metacpan

lib/Apache/ClearSilver.pm  view on Meta::CPAN

    _hdf_setValue($hdf, 'Query', \%query);
    my $http = {
        Accept         => $ENV{HTTP_ACCEPT}          || '',
        AcceptEncoding => $ENV{HTTP_ACCEPT_ENCODING} || '',
        AcceptLanguage => $ENV{HTTP_ACCEPT_LANGUAGE} || '',
        Cookie         => $ENV{HTTP_COOKIE}          || '',
        Host           => $ENV{HTTP_HOST}            || '',
        UserAgent      => $ENV{HTTP_USER_AGENT}      || '',
        Referer        => $ENV{HTTP_REFERER}         || '',
    };
    _hdf_setValue($hdf, 'HTTP', $http);

 view all matches for this distribution


Apache-Compress

 view release on metacpan or  search on metacpan

t/lib/Apache/test.pm  view on Meta::CPAN

	   return $net::callback_hooks{PERL_TABLE_API};
       }
   },
);

for (qw(Apache::Cookie Apache::Request)) {
    $really_have{$_} = $really_have{'Apache::Table'};
}

sub have_module {
    my $mod = shift;

t/lib/Apache/test.pm  view on Meta::CPAN

values are all 1.

=head1 EXAMPLES

No good examples yet.  Example submissions are welcome.  In the meantime, see
L<http://forum.swarthmore.edu/~ken/modules/Apache-AuthCookie/> , which
I'm retrofitting to use Apache::test.

=head1 TO DO

The MM_test method doesn't try to be very smart, it just writes the
text that seems to work in my configuration.  I am morally against
using the 'make' command for installing Perl modules (though of course
I do it anyway), so I haven't looked into this very much.  Send bug
reports or better (patches).

I've got lots of code in my Apache::AuthCookie module (etc.) that
assists in actually making the queries of the running server.  I plan
to add that to this module, but first I need to compare what's already
here that does the same stuff.

=head1 KUDOS

 view all matches for this distribution


Apache-ConfigParser

 view release on metacpan or  search on metacpan

lib/Apache/ConfigParser/Directive.pm  view on Meta::CPAN

  AuthDBUserFile
  AuthDigestFile
  AuthGroupFile
  AuthUserFile
  CacheRoot
  CookieLog
  CoreDumpDirectory
  CustomLog         check for "| prog"
  Directory
  DocumentRoot
  ErrorLog          check for "| prog", or syslog or syslog:facility

lib/Apache/ConfigParser/Directive.pm  view on Meta::CPAN

to the document being requested.

  AccessConfig
  AuthGroupFile
  AuthUserFile
  CookieLog
  CustomLog         check for "| prog"
  ErrorLog          check for "| prog", or syslog or syslog:facility
  Include
  IncludeOptional
  LoadFile

lib/Apache/ConfigParser/Directive.pm  view on Meta::CPAN

                        1,
                        \&directive_value_is_not_dev_null],
  CacheRoot         => ['0',
                        0,
                        \&directive_value_is_not_dev_null],
  CookieLog         => ['0',
                        1,
                        \&directive_value_is_not_dev_null],
  CoreDumpDirectory => ['0',
                        0,
                        \&directive_value_is_not_dev_null],

 view all matches for this distribution


Apache-CookieToQuery

 view release on metacpan or  search on metacpan

lib/Apache/CookieToQuery.pm  view on Meta::CPAN

package Apache::CookieToQuery;
use strict;

BEGIN {
	use vars qw ( $VERSION @COOKIE_NAMES %COOKIE_ALIASES );
	$VERSION     = 1.05;
}

use Apache;
use Apache::Constants qw( OK );
use CGI qw();
use Apache::Cookie;
use constant CONFIG_COOKIE_INCLUDE => 'IncludeCookie';
use constant CONFIG_COOKIE_ALIAS => 'CookieAlias';
use constant CONFIG_ALIAS_SEP => ':';

########################################### main pod documentation begin ##

=head1 NAME

	Apache::CookieToQuery - Rewrite query string by adding cookie information

=head1 SYNOPSIS

	In httpd.conf or similiar
	
	<Location /YourLocation>
		PerlAddVar IncludeCookie WSID
		PerlAddVar IncludeCookie SID
		PerlAddVar IncludeCookie QID
		PerlAddVar CookieAlias WSID:WebSiteId
		PerlAddVar CookieAlias QID:QueryId
		PerlFixupHandler Apache::CookieToQuery	
	</Location>

	Requests for http://yourhost/YourLocation?extra_params=12345
	
	Will now become rewritten so they look similiar to:

lib/Apache/CookieToQuery.pm  view on Meta::CPAN

	
	It requires mod_perl + Apache web server with PERL_FIXUP callback hook enabled
	for more information on callback hooks refer to: 
	http://perl.apache.org/docs/1.0/guide/install.html#Callback_Hooks
	
	IncludeCookie specifies cookie names that will be added, if none are specified
	any cookie name is taken into consideration
	
	CookieAlias specifies cookie name to look for and cookie name to alias it with 
	when query string is rewritten, if alias for a cookie name does not exist, 
	original cookie name will be used 
	
	Please note that in the current implementation cookies always take precedence 
	over query string paramaters 

lib/Apache/CookieToQuery.pm  view on Meta::CPAN

################################################## subroutine header end ##

sub handler {
	my $apache = shift;
	my $cgi = CGI->new ( { $apache->args } );
	my $cookies = Apache::Cookie->new( $apache )->fetch;
        %COOKIE_ALIASES = split CONFIG_ALIAS_SEP, join CONFIG_ALIAS_SEP, $apache->dir_config->get ( CONFIG_COOKIE_ALIAS ) unless %COOKIE_ALIASES;
	@COOKIE_NAMES = $apache->dir_config->get ( CONFIG_COOKIE_INCLUDE ) unless @COOKIE_NAMES;
	my $cookie_names = @COOKIE_NAMES ? 
		\@COOKIE_NAMES : 
			[ keys %$cookies ];

 view all matches for this distribution


Apache-CryptHash

 view release on metacpan or  search on metacpan

CryptHash.pm  view on Meta::CPAN

created on only the critical values. Decryption will fail if
the string has been altered and the MAC does not match when 
the string is decrypted.

Particularly useful when using COOKIES and will do all the 
hard work for Apache::AuthCookie

=over 4

=item C<init()>

 view all matches for this distribution


Apache-DebugInfo

 view release on metacpan or  search on metacpan

DebugInfo.pm  view on Meta::CPAN

  print $fh "\nDebug headers_in for [$ip] $uri during " .
    $r->current_callback . "\n";

  $r->headers_in->do(sub {
    my ($field, $value) = @_;
    if ($field =~ m/Cookie/) {
      my @values = split /; /, $value;
      foreach my $cookie (@values) {
        print $fh "\t$field => $cookie\n";
      }
    }

DebugInfo.pm  view on Meta::CPAN

  print $fh "\nDebug headers_out for [$ip] $uri during " .
    $r->current_callback . "\n";

  $r->headers_out->do(sub {
    my ($field, $value) = @_;
    if ($field =~ m/Cookie/) {
      my @values = split /;/, $value;
      print $fh "\t$field => $values[0]\n";
      for (my $i=1;$i < @values; $i++) {
        print $fh "\t\t=> $values[$i]\n";
      }

 view all matches for this distribution


Apache-DnsZone

 view release on metacpan or  search on metacpan

lib/Apache/DnsZone.pm  view on Meta::CPAN

use Apache::Request ();
use Apache::DnsZone::Config;
use Apache::DnsZone::Resolver;
use Apache::DnsZone::DB;
use Apache::DnsZone::Language;
use Apache::DnsZone::AuthCookie;
use Net::DNS;
use Net::IP qw(:PROC);
use HTML::Entities;
use Email::Valid;
use CGI::FastTemplate;

lib/Apache/DnsZone.pm  view on Meta::CPAN

    my $r = shift || Apache->request();
    Debug(3, qq{calling logout()});
    init($r);
    output_redirect($r, 1, $cfg->{'cfg'}->{DnsZoneLogoutHandler});
#    $r->push_handlers(PerlHandler => sub {
#      Apache::DnsZone::AuthCookie->logout(Apache->request);
#    });
    $dbh->close();
    return REDIRECT;
}

 view all matches for this distribution


Apache-ExtDirect

 view release on metacpan or  search on metacpan

t/04_env.t  view on Meta::CPAN

};

sub raw_post {
    my ($uri, $content) = @_;

    return [ Cookie => 'foo=bar', Content => $content ];
}

sub form_post {
    my ($uri, %fields) = @_;

 view all matches for this distribution


Apache-FakeCookie

 view release on metacpan or  search on metacpan

FakeCookie.pm  view on Meta::CPAN

package Apache::FakeCookie;

use vars qw($VERSION);
$VERSION = do { my @r = (q$Revision: 0.08 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };

# Oh!, we really don't live in this package

package Apache::Cookie;
use vars qw($Cookies);
use strict;

$Cookies = {};

# emluation is fairly complete
# cookies can be created, altered and removed
#
sub fetch { return wantarray ? %{$Cookies} : $Cookies; }
sub path {&do_this;}
sub secure {&do_this;}
sub name {&do_this;}
sub domain {&do_this;}
sub value {

FakeCookie.pm  view on Meta::CPAN

  } else {
    return wantarray ? () : '';
  }
}
sub new {
  my $proto = shift;	# bless into Apache::Cookie
  shift;		# waste reference to $r;
  my @vals = @_;
  my $self = {@vals};
  my $class = ref($proto) || $proto;
# make sure values are in array format

FakeCookie.pm  view on Meta::CPAN

  return $self;
}
sub bake {
  my $self = shift;
  if ( defined $self->{-value} ) {
    $Cookies->{$self->{-name}} = $self;
  } else {
    delete $Cookies->{$self->{-name}};
  }
}
sub parse {		# adapted from CGI::Cookie v1.20 by Lincoln Stein
  my ($self,$raw_cookie) = @_;
  if ($raw_cookie) {
    my $class = ref($self) || $self;
    my %results;

FakeCookie.pm  view on Meta::CPAN

      # appear.  The FIRST one in HTTP_COOKIE is the most recent version.
      $results{$key} ||= $self->new(undef,-name=>$key,-value=>\@values);
    }
    $self = \%results;
    bless $self, $class;
    $Cookies = $self;
  }
  @_ = ($self);
  goto &fetch;
}
sub expires {

FakeCookie.pm  view on Meta::CPAN

	if @_;
  return (exists $self->{-expires} &&
	  defined $self->{-expires})
	? $self->{-expires} : undef;
}
# Adapted from CGI::Cookie v1.20 by Lincoln Stein
# This internal routine creates date strings suitable for use in
# cookies and HTTP headers.  (They differ, unfortunately.)
# Thanks to Mark Fisher for this.
sub _expires {
    my($time) = @_;

FakeCookie.pm  view on Meta::CPAN

    my($sec,$min,$hour,$mday,$mon,$year,$wday) = gmtime($time);
    $year += 1900;
    return sprintf("%s, %02d$sc%s$sc%04d %02d:%02d:%02d GMT",
                   $WDAY[$wday],$mday,$MON[$mon],$year,$hour,$min,$sec);
}
# Copied directly from CGI::Cookie v1.20 by Lincoln Stein
# This internal routine creates an expires time exactly some number of
# hours from the current time.  It incorporates modifications from 
# Mark Fisher.
sub _expire_calc {
    my($time) = @_;

FakeCookie.pm  view on Meta::CPAN

    return (time+$offset);
}
sub remove {
  my ($self,$name) = @_;
  if ($name) {
    delete $Cookies->{$name} if exists $Cookies->{$name};
  } else {
    delete $Cookies->{$self->{-name}}
	if exists $Cookies->{$self->{-name}};
  }
}
sub as_string {
  my $self = shift;
  return '' unless $self->name;

FakeCookie.pm  view on Meta::CPAN

#
# Darn! this modifies a cookie item if user is generating
# a replacement cookie and has not yet "baked" it... 
# Don't see how this can hurt in the real world...  MAR 9-2-02
    if ( $item eq '-name' &&
	 exists $Cookies->{$self->{-name}} ) {
      $Cookies->{$val} = $Cookies->{$self->{-name}};
      delete  $Cookies->{$self->{-name}};
    }
    $self->{$item} = $val;
  }
  return (exists $self->{$item}) ? $self->{$item} : '';
}

FakeCookie.pm  view on Meta::CPAN

1
__END__

=head1 NAME

  Apache::FakeCookie - fake request object for debugging

=head1 SYNOPSIS

  use Apache::FakeCookie;

  loads into Apache::Cookie namespace

=head1 DESCRIPTION

This module assists authors of Apache::* modules write test suites that 
would use B<Apache::Cookie> without actually having to run and query
a server to test the cookie methods. Loaded in the test script after the
author's target module is loaded, B<Apache::FakeCookie>

Usage is the same as B<Apache::Cookie>

=head1 METHODS

Implements all methods of Apache::Cookie

See man Apache::Cookie for details of usage.

=over 4

=item remove	-- new method

Delete the given named cookie or the cookie represented by the pointer

  $cookie->remove;

  Apache::Cookie->remove('name required');

  $cookie->remove('some name');
	for test purposes, same as:
    $cookie = Apache::Cookie->new($r,
	-name	=> 'some name',
    );
    $cookie->bake;

=item new

  $cookie = Apache::Cookie->new($r,
	-name	 => 'some name',
	-value	 => 'my value',
	-expires => 'time or relative time,
	-path	 => 'some path',
	-domain	 => 'some.domain',

FakeCookie.pm  view on Meta::CPAN


=item fetch

  Return cookie values from local memory

  $cookies = Apache::Cookie->fetch;	# hash ref
  %cookies = Apache::Cookie->fetch;

=item as_string

  Format the cookie object as a string, 
  same as Apache::Cookie

=item parse

  The same as fetch unless a cookie string is present.

  $cookies = Apache::Cookie->fetch(raw cookie string);
  %cookies = Apache::Cookie->fetch(raw cookie string)

  Cookie memory is cleared and replaced with the contents
  of the parsed "raw cookie string".

=item name, value, domain, path, secure

  Get or set the value of the designated cookie.
  These are all just text strings for test use,
  "value" accepts SCALARS, HASHrefs, ARRAYrefs

=item expires

  Sets or returns time in the same format as Apache::Cookie 
  and CGI::Cookie. See their man pages for details

=back

=head1 SEE ALSO

Apache::Cookie(3)

=head1 AUTHORS

Michael Robinton michael@bizsystems.com
Inspiration and code for subs (expires, expires_calc, parse)

 view all matches for this distribution


Apache-FakeTable

 view release on metacpan or  search on metacpan

lib/Apache/FakeTable.pm  view on Meta::CPAN


  my $table = Apache::FakeTable->new($r);

  $table->set(From => 'david@example.com');

  $table->add(Cookie => 'One Cookie');
  $table->add(Cookie => 'Another Cookie');

  while(my($key, $val) = each %$table) {
      print "$key: $val\n";
  }

 view all matches for this distribution


Apache-FileManager

 view release on metacpan or  search on metacpan

FileManager.pm  view on Meta::CPAN

 Apache::Request => 1.00
 Apache::File    => 1.01
 File::NCopy     => 0.32
 File::Remove    => 0.20
 Archive::Any    => 0.03
 CGI::Cookie     => 1.20

=head1 SPECIAL NOTES

Make sure the web server has read, write, and execute access access to the
directory you want to manage files in. Typically you are going to want to

FileManager.pm  view on Meta::CPAN

use File::Copy   qw(move);
use File::Remove qw(remove);
use File::stat;
use Archive::Any;
use POSIX qw(strftime);
use CGI::Cookie;
use Apache::Constants ':common';
#use Data::Dumper;

require 5.005_62;

FileManager.pm  view on Meta::CPAN


  #get copy and cut file arrays
  my $buffer_type = "";
  my $buffer_filenames = [];

  if (r->header_in('Cookie')) {
    my $cookie_name = uc(r->server->server_hostname);
    $cookie_name =~ s/[^A-Z]//g;
    $cookie_name .= "_FM";
    my %cookies = CGI::Cookie->parse(r->header_in('Cookie'));
    if (exists $cookies{$cookie_name}) {
      my $data = $cookies{$cookie_name}->value;
      my @ar = split /\|/, $data;

      #is there something in buffer

 view all matches for this distribution


Apache-Filter

 view release on metacpan or  search on metacpan

t/lib/Apache/test.pm  view on Meta::CPAN

	   return $net::callback_hooks{PERL_TABLE_API};
       }
   },
);

for (qw(Apache::Cookie Apache::Request)) {
    $really_have{$_} = $really_have{'Apache::Table'};
}

sub have_module {
    my $mod = shift;

t/lib/Apache/test.pm  view on Meta::CPAN

values are all 1.

=head1 EXAMPLES

No good examples yet.  Example submissions are welcome.  In the meantime, see
L<http://forum.swarthmore.edu/~ken/modules/Apache-AuthCookie/> , which
I'm retrofitting to use Apache::test.

=head1 TO DO

The MM_test method doesn't try to be very smart, it just writes the
text that seems to work in my configuration.  I am morally against
using the 'make' command for installing Perl modules (though of course
I do it anyway), so I haven't looked into this very much.  Send bug
reports or better (patches).

I've got lots of code in my Apache::AuthCookie module (etc.) that
assists in actually making the queries of the running server.  I plan
to add that to this module, but first I need to compare what's already
here that does the same stuff.

=head1 KUDOS

 view all matches for this distribution


Apache-FilteringProxy

 view release on metacpan or  search on metacpan

lib/Apache/FilteringProxy.pm  view on Meta::CPAN

				$value .= "$_=".$cookiehash{$_}."; ";
			}

			$r->warn("new cookie data is '$name'='$value'") unless ($Apache::FilteringProxy::logging < 2);

			# Cookie headers may occur multiple times
			if ($value =~ /\S/) {
				$request->push_header ($name, $value);
			}
		} else {
			# push remaining headers as long as they aren't in our bad

 view all matches for this distribution


Apache-Gallery

 view release on metacpan or  search on metacpan

lib/Apache/Gallery.pm  view on Meta::CPAN

use File::stat;
use File::Spec;
use POSIX qw(floor);
use URI::Escape;
use CGI;
use CGI::Cookie;
use Encode;
use HTTP::Date;
use Digest::MD5 qw(md5_base64);

use Data::Dumper;

lib/Apache/Gallery.pm  view on Meta::CPAN

	}

	# Check if the selected width is allowed
	my @sizes = split (/ /, $r->dir_config('GallerySizes') ? $r->dir_config('GallerySizes') : '640 800 1024 1600');

	my %cookies = fetch CGI::Cookie;

	if ($cgi->param('width')) {
		unless ((grep $cgi->param('width') == $_, @sizes) or ($cgi->param('width') == $original_size)) {
			show_error($r, 200, "Invalid width", "The specified width is invalid");
			return $::MP2 ? Apache2::Const::OK() : Apache::Constants::OK();
		}

		$width = $cgi->param('width');
		my $cookie = new CGI::Cookie(-name => 'GallerySize', -value => $width, -expires => '+6M');
		$r->headers_out->{'Set-Cookie'} = $cookie;

	} elsif ($cookies{'GallerySize'} && (grep $cookies{'GallerySize'}->value == $_, @sizes)) {

		$width = $cookies{'GallerySize'}->value;

 view all matches for this distribution


Apache-HEADRegistry

 view release on metacpan or  search on metacpan

HEADRegistry.pm  view on Meta::CPAN

and/or modified under the same terms as Perl itself.

=head1 HISTORY

This code is derived in part from examples in the 
"The mod_perl Developer's Cookbook"

For more information, visit http://www.modperlcookbook.org/

It also contains code lifted from various mod_perl internal
sources, such as Apache.pm and mod_perl.c, and LWP.  Thanks

 view all matches for this distribution


Apache-Hendrix

 view release on metacpan or  search on metacpan

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

sub session_start {
    my $r = Apache::Hendrix->request;

    # Extract old session ID.  If not found we create a new one below
    my $id;
    if ( $r->headers_in->get('Cookie') =~ m/SESSION_ID=(\w*)/ ) {
        $id = $1;
    }

    my %session;
    try {

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

	}
    }

    # Might be a new session, so lets give them their cookie back
    my $session_cookie = "SESSION_ID=$session{_session_id};";
    $r->headers_out->set( 'Set-Cookie' => $session_cookie );
    return \%session;
}

__PACKAGE__->meta->make_immutable;

 view all matches for this distribution


( run in 2.934 seconds using v1.01-cache-2.11-cpan-995e09ba956 )