Apache2_4-AuthCookieMultiDBI

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

Apache2_4-AuthCookieMultiDBI-0.01.tar.gz
Apache2_4-AuthCookieMultiDBI-0.02.tar.gz
Apache2_4-AuthCookieMultiDBI-0.03.tar
Apache2_4-AuthCookieMultiDBI-0.03.tar.gz
lib/Apache2_4/AuthCookieMultiDBI.pm
LICENSE
Makefile.PL
MANIFEST			This list of files
README.pod
t/test.t
META.yml                                 Module YAML meta-data (added by MakeMaker)
META.json                                Module JSON meta-data (added by MakeMaker)

META.json  view on Meta::CPAN

{
   "abstract" : "An AuthCookie module backed by a DBI database for apache 2.4.",
   "author" : [
      "Details <details -at- cpan -dot- org>"
   ],
   "dynamic_config" : 1,
   "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.143240",
   "license" : [
      "unknown"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
      "version" : "2"
   },
   "name" : "Apache2_4-AuthCookieMultiDBI",
   "no_index" : {
      "directory" : [
         "t",
         "inc"
      ]
   },
   "prereqs" : {
      "build" : {
         "requires" : {
            "Test::More" : "1.302136"
         }
      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Apache2_4::AuthCookie" : "3.26",
            "DBI" : "1.641",
            "Date::Calc" : "6.4",
            "Digest::MD5" : "2.55",
            "English" : "1.10",
            "strict" : "0",
            "warnings" : "0"
         }
      }
   },
   "release_status" : "stable",

META.yml  view on Meta::CPAN

---
abstract: 'An AuthCookie module backed by a DBI database for apache 2.4.'
author:
  - 'Details <details -at- cpan -dot- org>'
build_requires:
  Test::More: '1.302136'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.143240'
license: unknown
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: Apache2_4-AuthCookieMultiDBI
no_index:
  directory:
    - t
    - inc
requires:
  Apache2_4::AuthCookie: '3.26'
  DBI: '1.641'
  Date::Calc: '6.4'
  Digest::MD5: '2.55'
  English: '1.10'
  strict: '0'
  warnings: '0'
version: '0.04'

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_4::AuthCookieMultiDBI',
    'VERSION_FROM'	=> 'lib/Apache2_4/AuthCookieMultiDBI.pm', # finds $VERSION
    'PREREQ_PM'		=> {
		'strict'                    => 0,
        'warnings'                  => 0,
        'Apache2_4::AuthCookie'     => '3.26 ',
        'Date::Calc'                => '6.4',
        'DBI'                       => '1.641',
        'Digest::MD5'               => '2.55',
        'English'                   => '1.10',

    }, # e.g., Module::Name => 1.1
    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
        (ABSTRACT_FROM => 'lib/Apache2_4/AuthCookieMultiDBI.pm', # retrieve abstract from module
        AUTHOR     => 'Details <details -at- cpan -dot- org>') : ()
    ),

    BUILD_REQUIRES => {
     	  'Test::More' => '1.302136'
    },
);

README.pod  view on Meta::CPAN

=head1 NAME

Apache2_4::AuthCookieMultiDBI - An AuthCookie module backed by a DBI database for apache 2.4.

=head1 VERSION

    This is version 0.4


=head1 SYNOPSIS

    # In httpd.conf or .htaccess
    
    # Optional: Initiate a persistent database connection using Apache::DBI.
    # See: http://search.cpan.org/dist/Apache-DBI/
    # If you choose to use Apache::DBI then the following directive must come
    # before all other modules using DBI - just uncomment the next line:
    #PerlModule Apache::DBI  
   
     
    PerlModule Apache2_4::AuthCookieHandler
    PerlSetVar WhatEverPath /
    PerlSetVar WhatEverLoginScript /login.pl

    # Optional, to share tickets between servers.
    PerlSetVar WhatEverDomain .domain.com
    
    # These must be set
    PerlSetVar WhatEverDBI_DSN "DBI:mysql:database=test"
    PerlSetVar WhatEverDBI_SecretKey "489e5eaad8b3208f9ad8792ef4afca73598ae666b0206a9c92ac877e73ce835c"

README.pod  view on Meta::CPAN

    PerlSetVar WhatEverDBI_CryptType "none"
    PerlSetVar WhatEverDBI_GroupsTable "groups"
    PerlSetVar WhatEverDBI_GroupField "grp"
    PerlSetVar WhatEverDBI_GroupUserField "user"
    PerlSetVar WhatEverDBI_EncryptionType "none"
    PerlSetVar WhatEverDBI_SessionLifetime 00-24-00-00
    perlSetVar WhatEverDBI_URIRegx "^/(.+)/(.+)$" # if have uri pattran like /client_id/file_name.pl
    perlSetVar WhatEverDBI_URIClientPos 0 # client_id position in uri
    perlSetVar WhatEverDBI_LoadClientDB 1 # do you have seperate database for each cleint

    # Protected by AuthCookieDBI.
    <Directory /www/domain.com/protected>
        AuthName WhatEver
        AuthType Apache2_4::AuthCookieMultiDBI
        PerlAuthenHandler Apache2_4::AuthCookieMultiDBI->authenticate
        require valid-user
    </Directory>

    # Login location.
    <Files LOGIN>
        AuthType Apache2_4::AuthCookieMultiDBI
        AuthName WhatEver
        SetHandler perl-script
        PerlResponseHandler Apache2_4::AuthCookieMultiDBI->login

        # If the directopry you are protecting is the DocumentRoot directory
        # then uncomment the following directive:
        #Satisfy any
    </Files>

=head1 DESCRIPTION

This module is an authentication handler that uses the basic mechanism provided
by Apache2_4::AuthCookie with a DBI database for ticket-based protection. Actually
it is modified version of L<Apache2::AuthCookieDBI> for apache 2.4. It
is based on two tokens being provided, a username and password, which can
be any strings (there are no illegal characters for either).  The username is
used to set the remote user as if Basic Authentication was used.

On an attempt to access a protected location without a valid cookie being
provided, the module prints an HTML login form (produced by a CGI or any
other handler; this can be a static file if you want to always send people
to the same entry page when they log in).  This login form has fields for
username and password.  On submitting it, the username and password are looked
up in the DBI database.  The supplied password is checked against the password

README.pod  view on Meta::CPAN


Please see the enclosed file CHANGES.

=head1 PROBLEMS?

If this doesn't work, let me know and I'll fix the code. Or by all means send a patch.
Please don't just post a bad review on CPAN.

=head1 SEE ALSO

L<Apache2::AuthCookieDBI>: L<Apache2_4::AuthCookie>.

=head1 AUTHOR

berlin3, details -at- cpan -dot- org.

=head1 COPYRIGHT

Copyright (C) details, 2018, ff. - All Rights Reserved.

This library is free software and may be used only under the same terms as Perl itself.

lib/Apache2_4/AuthCookieMultiDBI.pm  view on Meta::CPAN

package Apache2_4::AuthCookieMultiDBI;

$VERSION = 0.04;
$DATE = "01 June 2018";

use strict;
use warnings;

use base qw( Apache2_4::AuthCookie );

use Date::Calc qw( Today_and_Now Add_Delta_DHMS );
use DBI;
use Digest::MD5 qw( md5_hex );
use English qw(-no_match_vars);

use vars qw(@ISA);

my %CIPHERS = ();

lib/Apache2_4/AuthCookieMultiDBI.pm  view on Meta::CPAN

    DBI_LoadClientDB    => 0,               # 1 to set
    DBI_URIClientPos    => 1,
);

#===============================================================================
# P E R L D O C
#===============================================================================

=head1 NAME

Apache2_4::AuthCookieMultiDBI - An AuthCookie module backed by a DBI database for apache 2.4.

=head1 VERSION

    This is version 0.4


=head1 SYNOPSIS

    # In httpd.conf or .htaccess
    
    # Optional: Initiate a persistent database connection using Apache::DBI.
    # See: http://search.cpan.org/dist/Apache-DBI/
    # If you choose to use Apache::DBI then the following directive must come
    # before all other modules using DBI - just uncomment the next line:
    #PerlModule Apache::DBI  
   
     
    PerlModule Apache2_4::AuthCookieHandler
    PerlSetVar WhatEverPath /
    PerlSetVar WhatEverLoginScript /login.pl

    # Optional, to share tickets between servers.
    PerlSetVar WhatEverDomain .domain.com
    
    # These must be set
    PerlSetVar WhatEverDBI_DSN "DBI:mysql:database=test"
    PerlSetVar WhatEverDBI_SecretKey "489e5eaad8b3208f9ad8792ef4afca73598ae666b0206a9c92ac877e73ce835c"

lib/Apache2_4/AuthCookieMultiDBI.pm  view on Meta::CPAN

    PerlSetVar WhatEverDBI_CryptType "none"
    PerlSetVar WhatEverDBI_GroupsTable "groups"
    PerlSetVar WhatEverDBI_GroupField "grp"
    PerlSetVar WhatEverDBI_GroupUserField "user"
    PerlSetVar WhatEverDBI_EncryptionType "none"
    PerlSetVar WhatEverDBI_SessionLifetime 00-24-00-00
    perlSetVar WhatEverDBI_URIRegx "^/(.+)/(.+)$" # if have uri pattran like /client_id/file_name.pl
    perlSetVar WhatEverDBI_URIClientPos 0 # client_id position in uri
    perlSetVar WhatEverDBI_LoadClientDB 1 # do you have seperate database for each cleint

    # Protected by AuthCookieDBI.
    <Directory /www/domain.com/protected>
        AuthName WhatEver
        AuthType Apache2_4::AuthCookieMultiDBI
        PerlAuthenHandler Apache2_4::AuthCookieMultiDBI->authenticate
        require valid-user
    </Directory>

    # Login location.
    <Files LOGIN>
        AuthType Apache2_4::AuthCookieMultiDBI
        AuthName WhatEver
        SetHandler perl-script
        PerlResponseHandler Apache2_4::AuthCookieMultiDBI->login

        # If the directopry you are protecting is the DocumentRoot directory
        # then uncomment the following directive:
        #Satisfy any
    </Files>

=head1 DESCRIPTION

This module is an authentication handler that uses the basic mechanism provided
by Apache2_4::AuthCookie with a DBI database for ticket-based protection. Actually
it is modified version of L<Apache2::AuthCookieDBI> for apache 2.4. It
is based on two tokens being provided, a username and password, which can
be any strings (there are no illegal characters for either).  The username is
used to set the remote user as if Basic Authentication was used.

On an attempt to access a protected location without a valid cookie being
provided, the module prints an HTML login form (produced by a CGI or any
other handler; this can be a static file if you want to always send people
to the same entry page when they log in).  This login form has fields for
username and password.  On submitting it, the username and password are looked
up in the DBI database.  The supplied password is checked against the password

lib/Apache2_4/AuthCookieMultiDBI.pm  view on Meta::CPAN

    $session_key = $cipher->decrypt_hex($encrypted_session_key);
    return $session_key;
}


#===============================================================================
# O V E R R I D   F U N C T I O N S
#===============================================================================

#-------------------------------------------------------------------------------
# authen_ses_key -- Overrid authen_ses_key method from Apache2_4::AuthCookie
# 
sub authen_ses_key ($$$) {
    my ( $self, $r, $encrypted_session_key ) = @_;

    my $auth_name = $r->auth_name;

    # Get the configuration information.
    my %c = $self->_dbi_config_vars($r);

    # Get the secret key.

lib/Apache2_4/AuthCookieMultiDBI.pm  view on Meta::CPAN

    # hasn't passed too (in case we issued long-lived session tickets
    # in the past that we want to get rid of). *** TODO ***
    # if ( lc $c{'DBI_AlwaysUseCurrentSessionLifetime'} eq 'on' ) {

    # They must be okay, so return the user.
    return $user;

}

#-------------------------------------------------------------------------------
# authen_cred -- Overrid authen_cred method from Apache2_4::AuthCookie
# 
sub authen_cred ($$\@) {
    my $self = shift;
    my $r = shift;
    my $user = shift;
    my $password = shift;
    my @extra_data = @_;

    my $auth_name = $r->auth_name;
    ( $user, $password ) = _defined_or_empty( $user, $password );

lib/Apache2_4/AuthCookieMultiDBI.pm  view on Meta::CPAN


Please see the enclosed file CHANGES.

=head1 PROBLEMS?

If this doesn't work, let me know and I'll fix the code. Or by all means send a patch.
Please don't just post a bad review on CPAN.

=head1 SEE ALSO

L<Apache2::AuthCookieDBI>: L<Apache2_4::AuthCookie>.

=head1 AUTHOR

berlin3, details -at- cpan -dot- org.

=head1 COPYRIGHT

Copyright (C) details, 2018, ff. - All Rights Reserved.

This library is free software and may be used only under the same terms as Perl itself.

t/test.t  view on Meta::CPAN

# # $Finance::Currency::Convert::ECBdaily::CHAT=1;
# # print Finance::Currency::Convert::ECBdaily::convert(10,'GBP','HUF');

# exit;

use strict;
use warnings;
 
use Test::More tests => 1;
 
use_ok 'Apache2_4::AuthCookieMultiDBI';



( run in 0.909 second using v1.01-cache-2.11-cpan-e9199f4ba4c )