[libcgi-application-plugin-authentication-perl] 02/02: Add back driver-{cdbi, dbic} directories.

gregor herrmann gregoa at debian.org
Sat Nov 4 13:36:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository libcgi-application-plugin-authentication-perl.

commit cf2dde833889a23c576be07b953cc4abb0e5b4cf
Author: gregor herrmann <gregoa at debian.org>
Date:   Sat Nov 4 14:33:18 2017 +0100

    Add back driver-{cdbi,dbic} directories.
    
    These are the unpackaged and renamed tarballs after running
    debian/update.sh.
---
 driver-cdbi/Build.PL                               |  46 +++++
 driver-cdbi/Changes                                |   5 +
 driver-cdbi/MANIFEST                               |  18 ++
 driver-cdbi/META.json                              |  45 +++++
 driver-cdbi/META.yml                               |  27 +++
 driver-cdbi/README                                 |  86 +++++++++
 .../Plugin/Authentication/Driver/CDBI.pm           | 169 +++++++++++++++++
 driver-cdbi/t/00-load.t                            |   9 +
 driver-cdbi/t/authenticate.t                       |  62 ++++++
 driver-cdbi/t/authenticate_crypt.t                 |  47 +++++
 driver-cdbi/t/authenticate_md5.t                   |  47 +++++
 driver-cdbi/t/lib/TestAppAuthMD5.pm                |  34 ++++
 driver-cdbi/t/lib/TestAppAuthPlain.pm              |  33 ++++
 driver-cdbi/t/lib/TestAppAuthcrypt.pm              |  33 ++++
 driver-cdbi/t/lib/TestAppAuthenticate.pm           |  33 ++++
 driver-cdbi/t/lib/TestUsers.pm                     |  30 +++
 driver-cdbi/t/pod-coverage.t                       |   6 +
 driver-cdbi/t/pod.t                                |   6 +
 driver-dbic/.cvsignore                             |  10 +
 driver-dbic/Build.PL                               |  34 ++++
 driver-dbic/Changes                                |   9 +
 driver-dbic/MANIFEST                               |  23 +++
 driver-dbic/MANIFEST.SKIP                          |   8 +
 driver-dbic/META.yml                               |  28 +++
 driver-dbic/Makefile.PL                            |  17 ++
 driver-dbic/README                                 |  75 ++++++++
 driver-dbic/SIGNATURE                              |  45 +++++
 .../Plugin/Authentication/Driver/DBIC.pm           | 207 +++++++++++++++++++++
 driver-dbic/t/00-signature.t                       |  35 ++++
 driver-dbic/t/01-load.t                            |   9 +
 driver-dbic/t/authenticate.t                       |  62 ++++++
 driver-dbic/t/authenticate_crypt.t                 |  47 +++++
 driver-dbic/t/authenticate_md5.t                   |  47 +++++
 driver-dbic/t/lib/TestAppAuthMD5.pm                |  37 ++++
 driver-dbic/t/lib/TestAppAuthPlain.pm              |  36 ++++
 driver-dbic/t/lib/TestAppAuthcrypt.pm              |  36 ++++
 driver-dbic/t/lib/TestAppAuthenticate.pm           |  36 ++++
 driver-dbic/t/lib/TestDB.pm                        |  16 ++
 driver-dbic/t/lib/TestDB/Users.pm                  |  29 +++
 driver-dbic/t/pod-coverage.t                       |   8 +
 driver-dbic/t/pod.t                                |   8 +
 41 files changed, 1598 insertions(+)

diff --git a/driver-cdbi/Build.PL b/driver-cdbi/Build.PL
new file mode 100644
index 0000000..9aeadee
--- /dev/null
+++ b/driver-cdbi/Build.PL
@@ -0,0 +1,46 @@
+use strict;
+use warnings;
+use Module::Build;
+
+print <<'ADOPTME';
+-------------------------------------------------------------------
+ADOPT ME!    ADOPT ME!    ADOPT ME!    ADOPT ME!    ADOPT ME!
+-------------------------------------------------------------------
+CGI::Application::Plugin::Authentication::Driver::CDBI
+
+This is a module looking for a home. If you are still using it, you
+might want to adopt it. Write to modules at perl.org to ask to become
+its owner!
+
+Otherwise, this module is unsupported.
+-------------------------------------------------------------------
+ADOPT ME!    ADOPT ME!    ADOPT ME!    ADOPT ME!    ADOPT ME!
+-------------------------------------------------------------------
+
+(I'll give you 5 seconds to think about that).
+ADOPTME
+
+sleep 5;
+
+my $builder = Module::Build->new(
+  module_name => 'CGI::Application::Plugin::Authentication::Driver::CDBI',
+  license            => 'perl',
+  create_readme      => 1,
+  configure_requires => { 'Module::Build' => 0.38 },
+  dist_author        => 'Shawn Sorichetti <ssoriche at coloredblocks.net>',
+  dist_version_from  =>
+    'lib/CGI/Application/Plugin/Authentication/Driver/CDBI.pm',
+  requires => {
+    'Test::More'                               => '0',
+    'CGI::Application::Plugin::Authentication' => '0.06',
+    'Class::DBI'                               => '0',
+    'DBD::SQLite'                              => '0',
+	'CGI::Application::Plugin::Session'        => '0',
+ },
+  resources => {
+    repository => 'https://github.com/briandfoy/CGI-Application-Plugin-Authentication-Driver-CDBI',
+    },
+  add_to_cleanup => ['CGI-Application-Plugin-Authentication-Driver-CDBI-*'],
+);
+
+$builder->create_build_script();
diff --git a/driver-cdbi/Changes b/driver-cdbi/Changes
new file mode 100644
index 0000000..b8c78ff
--- /dev/null
+++ b/driver-cdbi/Changes
@@ -0,0 +1,5 @@
+Revision history for CGI-Application-Plugin-Authentication-Driver-CDBI
+
+0.01    Date/time
+        First version, released on an unsuspecting world.
+
diff --git a/driver-cdbi/MANIFEST b/driver-cdbi/MANIFEST
new file mode 100644
index 0000000..4930f18
--- /dev/null
+++ b/driver-cdbi/MANIFEST
@@ -0,0 +1,18 @@
+Build.PL
+Changes
+lib/CGI/Application/Plugin/Authentication/Driver/CDBI.pm
+MANIFEST
+META.yml			# Will be created by "make dist"
+README
+t/00-load.t
+t/authenticate.t
+t/authenticate_crypt.t
+t/authenticate_md5.t
+t/lib/TestAppAuthcrypt.pm
+t/lib/TestAppAuthenticate.pm
+t/lib/TestAppAuthMD5.pm
+t/lib/TestAppAuthPlain.pm
+t/lib/TestUsers.pm
+t/pod-coverage.t
+t/pod.t
+META.json
diff --git a/driver-cdbi/META.json b/driver-cdbi/META.json
new file mode 100644
index 0000000..d880ebd
--- /dev/null
+++ b/driver-cdbi/META.json
@@ -0,0 +1,45 @@
+{
+   "abstract" : "Class::DBI Authentication Driver",
+   "author" : [
+      "Shawn Sorichetti <ssoriche at coloredblocks.net>"
+   ],
+   "dynamic_config" : 1,
+   "generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.110440",
+   "license" : [
+      "perl_5"
+   ],
+   "meta-spec" : {
+      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+      "version" : "2"
+   },
+   "name" : "CGI-Application-Plugin-Authentication-Driver-CDBI",
+   "prereqs" : {
+      "configure" : {
+         "requires" : {
+            "Module::Build" : "0.38"
+         }
+      },
+      "runtime" : {
+         "requires" : {
+            "CGI::Application::Plugin::Authentication" : "0.06",
+            "CGI::Application::Plugin::Session" : 0,
+            "Class::DBI" : 0,
+            "DBD::SQLite" : 0,
+            "Test::More" : 0
+         }
+      }
+   },
+   "provides" : {
+      "CGI::Application::Plugin::Authentication::Driver::CDBI" : {
+         "file" : "lib/CGI/Application/Plugin/Authentication/Driver/CDBI.pm",
+         "version" : "0.03"
+      }
+   },
+   "release_status" : "stable",
+   "resources" : {
+      "license" : [
+         "http://dev.perl.org/licenses/"
+      ]
+   },
+   "version" : "0.03"
+}
diff --git a/driver-cdbi/META.yml b/driver-cdbi/META.yml
new file mode 100644
index 0000000..c67d448
--- /dev/null
+++ b/driver-cdbi/META.yml
@@ -0,0 +1,27 @@
+---
+abstract: 'Class::DBI Authentication Driver'
+author:
+  - 'Shawn Sorichetti <ssoriche at coloredblocks.net>'
+build_requires: {}
+configure_requires:
+  Module::Build: 0.38
+dynamic_config: 1
+generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.110440'
+license: perl
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: CGI-Application-Plugin-Authentication-Driver-CDBI
+provides:
+  CGI::Application::Plugin::Authentication::Driver::CDBI:
+    file: lib/CGI/Application/Plugin/Authentication/Driver/CDBI.pm
+    version: 0.03
+requires:
+  CGI::Application::Plugin::Authentication: 0.06
+  CGI::Application::Plugin::Session: 0
+  Class::DBI: 0
+  DBD::SQLite: 0
+  Test::More: 0
+resources:
+  license: http://dev.perl.org/licenses/
+version: 0.03
diff --git a/driver-cdbi/README b/driver-cdbi/README
new file mode 100644
index 0000000..9210857
--- /dev/null
+++ b/driver-cdbi/README
@@ -0,0 +1,86 @@
+NAME
+    THIS MODULE IS UNSUPPORTED! YOU CAN ADOPT IT IF YOU LIKE IT! WRITE TO
+    modules at perl.org IF YOU WANT TO MAINTAIN IT.
+
+    CGI::Application::Plugin::Authentication::Driver::CDBI - Class::DBI
+    Authentication Driver
+
+VERSION
+    Version 0.03
+
+    THIS MODULE IS UNSUPPORTED! YOU CAN ADOPT IT IF YOU LIKE IT! WRITE TO
+    modules at perl.org IF YOU WANT TO MAINTAIN IT.
+
+SYNOPSIS
+      use base qw(CGI::Application);
+      use CGI::Application::Plugin::Authentication;
+
+      __PACKAGE__->authen->config(
+        DRIVER => [ 'CDBI',
+          CLASS   => 'My::CDBI::Users',
+          FIELD_METHODS => [qw(user MD5:passphrase)]
+        ],
+        CREDENTIALS => [qw(auth_username auth_password)],
+      );
+
+DESCRIPTION
+    This Authentication driver uses the Class::DBI module to allow you to
+    authenticate against any Class::DBI class.
+
+PARAMETERS
+    The Class::DBI authentication driver accepts the following required
+    parameters.
+
+  CLASS (required)
+    Specifies the Class::DBI class to use for authentication. This class
+    must be loaded prior to use.
+
+  FIELD_METHODS (required)
+    FIELD_METHODS is an arrayref of the methods in the Class::DBI class
+    specified by CLASS to be used during authentication. The order of these
+    methods needs to match the order of the CREDENTIALS. For example, if
+    CREDENTIALS is set to:
+
+      CREDENTIALS => [qw(auth_user auth_domain auth_password)]
+
+    Then FIELD_METHODS must be set to:
+
+      FIELD_METHODS => [qw(userid domain password)]
+
+    FIELD_METHODS supports filters as specified by
+    CGI::Application::Plugin::Authentication::Driver
+
+METHODS
+  verify_credentials
+    This method will test the provided credentials against the values found
+    in the database, according to the Driver configuration.
+
+SEE ALSO
+    CGI::Application::Plugin::Authentication::Driver,
+    CGI::Application::Plugin::Authentication, perl(1)
+
+AUTHOR
+    Shawn Sorichetti, "<ssoriche at coloredblocks.net>"
+
+BUGS
+    Please report any bugs or feature requests to
+    "bug-cgi-application-plugin-authentication-driver-cdbi at rt.cpan.org", or
+    through the web interface at
+    <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-A
+    uthentication-Driver-CDBI>. I will be notified, and then you'll
+    automatically be notified of progress on your bug as I make changes.
+
+ACKNOWLEDGEMENTS
+    Special thanks to Cees Hek for writing
+    CGI::Application::Plugin::Authentication and his assistance in writing
+    this module.
+
+COPYRIGHT & LICENSE
+    THIS MODULE IS UNSUPPORTED! YOU CAN ADOPT IT IF YOU LIKE IT! WRITE TO
+    modules at perl.org IF YOU WANT TO MAINTAIN IT.
+
+    Copyright 2005 Shawn Sorichetti, all rights reserved.
+
+    This program is free software; you can redistribute it and/or modify it
+    under the same terms as Perl itself.
+
diff --git a/driver-cdbi/lib/CGI/Application/Plugin/Authentication/Driver/CDBI.pm b/driver-cdbi/lib/CGI/Application/Plugin/Authentication/Driver/CDBI.pm
new file mode 100644
index 0000000..f28e116
--- /dev/null
+++ b/driver-cdbi/lib/CGI/Application/Plugin/Authentication/Driver/CDBI.pm
@@ -0,0 +1,169 @@
+package CGI::Application::Plugin::Authentication::Driver::CDBI;
+
+use warnings;
+use strict;
+
+use base 'CGI::Application::Plugin::Authentication::Driver';
+
+=head1 NAME
+
+THIS MODULE IS UNSUPPORTED! YOU CAN ADOPT IT IF YOU LIKE IT! WRITE TO
+modules at perl.org IF YOU WANT TO MAINTAIN IT.
+
+CGI::Application::Plugin::Authentication::Driver::CDBI - Class::DBI Authentication Driver
+
+=head1 VERSION
+
+Version 0.03
+
+THIS MODULE IS UNSUPPORTED! YOU CAN ADOPT IT IF YOU LIKE IT! WRITE TO
+modules at perl.org IF YOU WANT TO MAINTAIN IT.
+
+=cut
+
+our $VERSION = '0.03';
+
+=head1 SYNOPSIS
+
+  use base qw(CGI::Application);
+  use CGI::Application::Plugin::Authentication;
+
+  __PACKAGE__->authen->config(
+    DRIVER => [ 'CDBI',
+      CLASS   => 'My::CDBI::Users',
+      FIELD_METHODS => [qw(user MD5:passphrase)]
+    ],
+    CREDENTIALS => [qw(auth_username auth_password)],
+  );
+
+=head1 DESCRIPTION
+
+This Authentication driver uses the Class::DBI module to allow you to 
+authenticate against any Class::DBI class.  
+
+=head1 PARAMETERS
+
+The Class::DBI authentication driver accepts the following required
+parameters.
+
+=head2 CLASS (required)
+
+Specifies the Class::DBI class to use for authentication. This class must
+be loaded prior to use.
+
+=head2 FIELD_METHODS (required)
+
+FIELD_METHODS is an arrayref of the methods in the Class::DBI class
+specified by CLASS to be used during authentication. The order of these
+methods needs to match the order of the CREDENTIALS. For example, if
+CREDENTIALS is set to: 
+
+  CREDENTIALS => [qw(auth_user auth_domain auth_password)]
+
+Then FIELD_METHODS must be set to:
+
+  FIELD_METHODS => [qw(userid domain password)]
+
+FIELD_METHODS supports filters as specified by 
+CGI::Application::Plugin::Authentication::Driver
+
+=head1 METHODS
+
+=head2 verify_credentials
+
+This method will test the provided credentials against the values found in 
+the database, according to the Driver configuration.
+
+=cut
+
+sub verify_credentials {
+  my $self = shift;
+  my @creds = @_;
+
+  my @_options=$self->options;
+  die "The Class::DBI driver requires a hash of options" if @_options % 2;
+  my %options=@_options;
+
+  my $cdbiclass=$options{CLASS};
+  die "CLASS option must be set." unless($cdbiclass);
+
+  return unless(scalar(@creds) eq scalar(@{$options{FIELD_METHODS}}));
+
+  my @crednames=@{$self->authen->credentials};
+
+  my %search;
+  my %compare;
+  my $i=0;
+
+  # There's a lot of remapping lists/arrays into hashes here
+  # Most of this is due to needing a hash to perform a search,
+  # and another hash to perform comparisions if the search is
+  # encrypted. Also verify that columns that exist have been specified.
+  for(@{$options{FIELD_METHODS}}) {
+    $search{$_}=$creds[$i] unless /:/;
+    $compare{$_}=$creds[$i] if /:/;
+    my $column=$self->strip_field_names($_);
+    die "Column $column not in $cdbiclass" unless($cdbiclass->can($column));
+    $i++;
+  }
+
+  my @users=$options{CLASS}->search( %search );
+  return unless(@users);
+
+  # We want to return the value of the first column specified.
+  # Could probably just return $creds[0] as that value should match
+  # but I've chosen to return what's in the DB.
+  my $field = ( @{ $options{FIELD_METHODS} } )[0];
+  if (%compare) {
+    foreach my $encoded ( keys(%compare) ) {
+      my $column = $self->strip_field_names($encoded);
+      # No point checking the rest of the columns if any of the encoded ones
+      # do not match.
+      return
+        unless (
+        $self->check_filtered(
+          $encoded, $compare{$encoded}, $users[0]->$column
+        )
+        );
+    }
+  }
+  # If we've made it this far, we have a valid user. Set the user object and
+  # Return the value of the first credentail.
+  return $users[0]->$field;
+}
+
+=head1 SEE ALSO
+
+L<CGI::Application::Plugin::Authentication::Driver>, 
+L<CGI::Application::Plugin::Authentication>, perl(1)
+
+=head1 AUTHOR
+
+Shawn Sorichetti, C<< <ssoriche at coloredblocks.net> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-cgi-application-plugin-authentication-driver-cdbi at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-Authentication-Driver-CDBI>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 ACKNOWLEDGEMENTS
+
+Special thanks to Cees Hek for writing CGI::Application::Plugin::Authentication 
+and his assistance in writing this module.
+
+=head1 COPYRIGHT & LICENSE
+
+THIS MODULE IS UNSUPPORTED! YOU CAN ADOPT IT IF YOU LIKE IT! WRITE TO
+modules at perl.org IF YOU WANT TO MAINTAIN IT.
+
+Copyright 2005 Shawn Sorichetti, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1; # End of CGI::Application::Plugin::Authentication::Driver::CDBI
diff --git a/driver-cdbi/t/00-load.t b/driver-cdbi/t/00-load.t
new file mode 100644
index 0000000..43ce72f
--- /dev/null
+++ b/driver-cdbi/t/00-load.t
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+	use_ok( 'CGI::Application::Plugin::Authentication::Driver::CDBI' );
+}
+
+diag( "Testing CGI::Application::Plugin::Authentication::Driver::CDBI $CGI::Application::Plugin::Authentication::Driver::CDBI::VERSION, Perl $], $^X" );
diff --git a/driver-cdbi/t/authenticate.t b/driver-cdbi/t/authenticate.t
new file mode 100644
index 0000000..794b6ee
--- /dev/null
+++ b/driver-cdbi/t/authenticate.t
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+use Test::More;
+use lib 't/lib';
+
+eval "use CGI::Application::Plugin::Session";
+plan skip_all => "CGI::Application::Plugin::Session required for this test"
+  if $@;
+
+eval "use DBD::SQLite";
+plan skip_all => "DBD::SQLite required for this test"
+  if $@;
+
+plan tests => 8;
+
+use strict;
+use warnings;
+
+use CGI ();
+use TestAppAuthenticate;
+use TestUsers;
+use File::Path;
+
+mkpath(['t/db']);
+TestUsers->setuptables;
+
+$ENV{CGI_APP_RETURN_ONLY} = 1;
+
+# Missing Credentials
+my $query =
+  CGI->new( { auth_username => 'user1', rm => 'two' } );
+
+my $cgiapp = TestAppAuthenticate->new( QUERY => $query );
+
+my $results = $cgiapp->run;
+
+ok(!$cgiapp->authen->is_authenticated,'missing credentials - login failure');
+is( $cgiapp->authen->username, undef, 'missing credentials - username not set' );
+
+# Successful Login
+$query =
+ CGI->new( { auth_username => 'user1', auth_password => '123', rm => 'two' } );
+
+$cgiapp = TestAppAuthenticate->new( QUERY => $query );
+$results = $cgiapp->run;
+
+ok($cgiapp->authen->is_authenticated,'successful login');
+is( $cgiapp->authen->username, 'user1', 'successful login - username set' );
+is( $cgiapp->authen->login_attempts, 0, "successful login - failed login count" );
+
+# Bad user or password
+$query =
+ CGI->new( { auth_username => 'user2', auth_password => '123', rm => 'two' } );
+$cgiapp = TestAppAuthenticate->new( QUERY => $query );
+$results = $cgiapp->run;
+
+ok(!$cgiapp->authen->is_authenticated,'login failure');
+is( $cgiapp->authen->username, undef, "login failure - username not set" );
+is( $cgiapp->authen->login_attempts, 1, "login failure - failed login count" );
+
+END {
+  rmtree(['t/db']);
+}
diff --git a/driver-cdbi/t/authenticate_crypt.t b/driver-cdbi/t/authenticate_crypt.t
new file mode 100644
index 0000000..46b76cf
--- /dev/null
+++ b/driver-cdbi/t/authenticate_crypt.t
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+use Test::More;
+use lib 't/lib';
+
+eval "use CGI::Application::Plugin::Session";
+plan skip_all => "CGI::Application::Plugin::Session required for this test"
+  if $@;
+
+eval "use DBD::SQLite";
+plan skip_all => "DBD::SQLite required for this test"
+  if $@;
+
+plan tests => 3;
+
+use strict;
+use warnings;
+
+use CGI ();
+use TestAppAuthcrypt;
+use TestUsers;
+use File::Path;
+
+mkpath(['t/db']);
+TestUsers->setuptables;
+
+$ENV{CGI_APP_RETURN_ONLY} = 1;
+
+my $query = CGI->new(
+  {
+    auth_username => 'usercrypt',
+    auth_password => 'testpassword',
+    rm            => 'two'
+  }
+);
+
+my $cgiapp  = TestAppAuthcrypt->new( QUERY => $query );
+my $results = $cgiapp->run;
+
+ok( $cgiapp->authen->is_authenticated, 'successful login crypt' );
+is( $cgiapp->authen->username, 'usercrypt',
+  'successful login crypt - username set' );
+is( $cgiapp->authen->login_attempts,
+  0, "successful login crypt - failed login count" );
+
+END {
+  rmtree(['t/db']);
+}
diff --git a/driver-cdbi/t/authenticate_md5.t b/driver-cdbi/t/authenticate_md5.t
new file mode 100644
index 0000000..c6a5971
--- /dev/null
+++ b/driver-cdbi/t/authenticate_md5.t
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+use Test::More;
+use lib 't/lib';
+
+eval "use CGI::Application::Plugin::Session";
+plan skip_all => "CGI::Application::Plugin::Session required for this test"
+  if $@;
+
+eval "use Digest::MD5";
+plan skip_all => "Digest::MD5 required for this test"
+  if $@;
+
+eval "use DBD::SQLite";
+plan skip_all => "DBD::SQLite required for this test"
+  if $@;
+
+plan tests => 3;
+
+use strict;
+use warnings;
+
+use CGI ();
+use TestAppAuthMD5;
+use TestUsers;
+use File::Path;
+
+mkpath(['t/db']);
+TestUsers->setuptables;
+
+$ENV{CGI_APP_RETURN_ONLY} = 1;
+
+my $query =
+  CGI->new(
+  { auth_username => 'usermd5', auth_password => 'testpassword', rm => 'two' }
+  );
+
+my $cgiapp  = TestAppAuthMD5->new( QUERY => $query );
+my $results = $cgiapp->run;
+
+ok( $cgiapp->authen->is_authenticated, 'successful login MD5' );
+is( $cgiapp->authen->username, 'usermd5', 'successful login MD5 - username set' );
+is( $cgiapp->authen->login_attempts,
+  0, "successful login MD5 - failed login count" );
+
+END {
+  rmtree(['t/db']);
+}
diff --git a/driver-cdbi/t/lib/TestAppAuthMD5.pm b/driver-cdbi/t/lib/TestAppAuthMD5.pm
new file mode 100644
index 0000000..c974d0b
--- /dev/null
+++ b/driver-cdbi/t/lib/TestAppAuthMD5.pm
@@ -0,0 +1,34 @@
+package TestAppAuthMD5;
+
+use base qw(CGI::Application);
+use CGI::Application::Plugin::Session;
+use CGI::Application::Plugin::Authentication;
+
+my %config = (
+  DRIVER => [
+    'CDBI',
+    CLASS      => 'TestUsers',
+    FIELD_METHODS => [qw(user MD5:passphrase)]
+  ],
+  CREDENTIALS => [qw(auth_username auth_password)],
+  STORE       => 'Session',
+);
+
+__PACKAGE__->authen->config(%config);
+
+sub setup {
+  my $self = shift;
+  $self->start_mode('one');
+  $self->run_modes([qw(one two)]);
+  $self->authen->protected_runmodes(qw(two));
+}
+
+sub one {
+  my $self = shift;
+}
+
+sub two {
+  my $self = shift;
+}
+
+1;
diff --git a/driver-cdbi/t/lib/TestAppAuthPlain.pm b/driver-cdbi/t/lib/TestAppAuthPlain.pm
new file mode 100644
index 0000000..b81fb77
--- /dev/null
+++ b/driver-cdbi/t/lib/TestAppAuthPlain.pm
@@ -0,0 +1,33 @@
+package TestAppAuthPlain;
+
+use base qw(CGI::Application);
+use CGI::Application::Plugin::Session;
+use CGI::Application::Plugin::Authentication;
+
+my %config = (
+  DRIVER => [
+    'CDBI',
+    CLASS   => 'TestUsers',
+    FIELD_METHODS => [qw(user plain:passphrase)]
+  ],
+  CREDENTIALS => [qw(auth_username auth_password)],
+  STORE       => 'Session',
+);
+
+__PACKAGE__->auth->config(%config);
+
+sub setup {
+  my $self = shift;
+  $self->start_mode('one');
+  $self->run_modes(qw(one two));
+  $self->auth->protected_runmodes(qw(two));
+}
+
+sub one {
+  my $self = shift;
+}
+
+sub two {
+  my $self = shift;
+}
+1;
diff --git a/driver-cdbi/t/lib/TestAppAuthcrypt.pm b/driver-cdbi/t/lib/TestAppAuthcrypt.pm
new file mode 100644
index 0000000..5697d1a
--- /dev/null
+++ b/driver-cdbi/t/lib/TestAppAuthcrypt.pm
@@ -0,0 +1,33 @@
+package TestAppAuthcrypt;
+
+use base qw(CGI::Application);
+use CGI::Application::Plugin::Session;
+use CGI::Application::Plugin::Authentication;
+
+my %config = (
+  DRIVER => [
+    'CDBI',
+    CLASS   => 'TestUsers',
+    FIELD_METHODS => [qw(user crypt:passphrase)]
+  ],
+  CREDENTIALS => [qw(auth_username auth_password)],
+  STORE       => 'Session',
+);
+
+__PACKAGE__->authen->config(%config);
+
+sub setup {
+  my $self = shift;
+  $self->start_mode('one');
+  $self->run_modes( [ qw(one two) ]);
+  $self->authen->protected_runmodes(qw(two));
+}
+
+sub one {
+  my $self = shift;
+}
+
+sub two {
+  my $self = shift;
+}
+1;
diff --git a/driver-cdbi/t/lib/TestAppAuthenticate.pm b/driver-cdbi/t/lib/TestAppAuthenticate.pm
new file mode 100644
index 0000000..32bdce5
--- /dev/null
+++ b/driver-cdbi/t/lib/TestAppAuthenticate.pm
@@ -0,0 +1,33 @@
+package TestAppAuthenticate;
+
+use base qw(CGI::Application);
+use CGI::Application::Plugin::Session;
+use CGI::Application::Plugin::Authentication;
+
+__PACKAGE__->authen->config(
+  DRIVER => [
+    'CDBI',
+    CLASS   => 'TestUsers',
+    FIELD_METHODS => [qw(user passphrase)]
+  ],
+  CREDENTIALS => [qw(auth_username auth_password)],
+  STORE       => 'Session',
+);
+
+
+sub setup {
+  my $self = shift;
+  $self->start_mode('one');
+  $self->run_modes([ qw(one two) ]);
+  $self->authen->protected_runmodes(qw(two));
+}
+
+sub one {
+  my $self = shift;
+}
+
+sub two {
+  my $self = shift;
+}
+1;
+
diff --git a/driver-cdbi/t/lib/TestUsers.pm b/driver-cdbi/t/lib/TestUsers.pm
new file mode 100644
index 0000000..04f2ed2
--- /dev/null
+++ b/driver-cdbi/t/lib/TestUsers.pm
@@ -0,0 +1,30 @@
+package TestUsers;
+
+use base 'Class::DBI';
+
+__PACKAGE__->connection('dbi:SQLite:t/db/users.db');
+__PACKAGE__->table('users');
+__PACKAGE__->columns( All => qw[user passphrase] );
+
+sub setuptables {
+  my $dbh=DBI->connect('dbi:SQLite:t/db/users.db');
+  {
+    local $/="\n\n";
+    $dbh->do($_) for <DATA>
+  }
+}
+
+1;
+
+__DATA__
+CREATE TABLE users (
+  user varchar(16) PRIMARY KEY,
+  passphrase varchar(25)
+);
+
+INSERT INTO users VALUES ('user1','123');
+
+INSERT INTO users VALUES ('usermd5','e16b2ab8d12314bf4efbd6203906ea6c');
+
+INSERT INTO users VALUES ('usercrypt','111ukgxvMW4Lw');
+
diff --git a/driver-cdbi/t/pod-coverage.t b/driver-cdbi/t/pod-coverage.t
new file mode 100644
index 0000000..703f91d
--- /dev/null
+++ b/driver-cdbi/t/pod-coverage.t
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
diff --git a/driver-cdbi/t/pod.t b/driver-cdbi/t/pod.t
new file mode 100644
index 0000000..976d7cd
--- /dev/null
+++ b/driver-cdbi/t/pod.t
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
diff --git a/driver-dbic/.cvsignore b/driver-dbic/.cvsignore
new file mode 100644
index 0000000..46a067d
--- /dev/null
+++ b/driver-dbic/.cvsignore
@@ -0,0 +1,10 @@
+blib*
+Makefile
+Makefile.old
+Build
+_build*
+pm_to_blib*
+*.tar.gz
+.lwpcookies
+CGI-Application-Plugin-Authentication-Driver-DBIC-*
+cover_db
diff --git a/driver-dbic/Build.PL b/driver-dbic/Build.PL
new file mode 100644
index 0000000..ee6c77f
--- /dev/null
+++ b/driver-dbic/Build.PL
@@ -0,0 +1,34 @@
+use strict;
+use warnings;
+use Module::Build;
+
+my $builder = Module::Build->new(
+    module_name         => 'CGI::Application::Plugin::Authentication::Driver::DBIC',
+    license             => 'perl',
+    dist_author         => 'Jaldhar H. Vyas <jaldhar at braincells.com>',
+    dist_version_from   => 'lib/CGI/Application/Plugin/Authentication/Driver/DBIC.pm',
+    build_requires => {
+        'CGI'                                      => 0,
+        'CGI::Application::Plugin::Authentication' => 0.06,
+        'DBIx::Class'                              => 0,
+        'File::Path'                               => 0,
+        'Test::More'                               => 0,
+    },
+    recommends => {
+        'CGI::Application::Plugin::Session'        => 0,
+        'DBD::SQLite'                              => 0,
+        'Digest::MD5'                              => 0,
+        'Module::Signature'                        => 0,
+        'Test::Pod'                                => 1.14,
+        'Test::Pod::Coverage'                      => 1.04,
+    },
+    requires => {
+        'CGI::Application::Plugin::Authentication' => 0.06,
+        'DBIx::Class'                              => 0,
+    },
+    add_to_cleanup      => [ 'CGI-Application-Plugin-Authentication-Driver-DBIC-*' ],
+    create_makefile_pl => 'traditional',
+    sign => 1,
+);
+
+$builder->create_build_script();
diff --git a/driver-dbic/Changes b/driver-dbic/Changes
new file mode 100644
index 0000000..a7d7653
--- /dev/null
+++ b/driver-dbic/Changes
@@ -0,0 +1,9 @@
+Revision history for CGI-Application-Plugin-Authentication-Driver-DBIC
+
+0.01    Tue Apr 25 10:20:21 EDT 2007
+        First upload to CPAN.
+
+0.02    Tue May 29 23:26:07 EDT 2007
+        Added a 'use lib' to tests so that the test modules could be 
+        properly found.  Thanks Joenio Marques da Costa <joenio at gmail.com>
+        (Closes rt.cpan.org: #27318, #27319)
diff --git a/driver-dbic/MANIFEST b/driver-dbic/MANIFEST
new file mode 100644
index 0000000..ae702fa
--- /dev/null
+++ b/driver-dbic/MANIFEST
@@ -0,0 +1,23 @@
+.cvsignore
+Build.PL
+Changes
+lib/CGI/Application/Plugin/Authentication/Driver/DBIC.pm
+MANIFEST
+MANIFEST.SKIP
+Makefile.PL
+META.yml			# Will be created by "make dist"
+README
+t/00-signature.t
+t/01-load.t
+t/authenticate.t
+t/authenticate_crypt.t
+t/authenticate_md5.t
+t/lib/TestAppAuthcrypt.pm
+t/lib/TestAppAuthenticate.pm
+t/lib/TestAppAuthMD5.pm
+t/lib/TestAppAuthPlain.pm
+t/lib/TestDB.pm
+t/lib/TestDB/Users.pm
+t/pod-coverage.t
+t/pod.t
+SIGNATURE    Added here by Module::Build
diff --git a/driver-dbic/MANIFEST.SKIP b/driver-dbic/MANIFEST.SKIP
new file mode 100644
index 0000000..c6f3a30
--- /dev/null
+++ b/driver-dbic/MANIFEST.SKIP
@@ -0,0 +1,8 @@
+#defaults
+^Makefile$
+^blib/
+^pm_to_blib
+^blibdirs
+^Build$
+^_build/
+.svn
diff --git a/driver-dbic/META.yml b/driver-dbic/META.yml
new file mode 100644
index 0000000..6e11d4e
--- /dev/null
+++ b/driver-dbic/META.yml
@@ -0,0 +1,28 @@
+---
+name: CGI-Application-Plugin-Authentication-Driver-DBIC
+version: 0.02
+author:
+  - 'Jaldhar H. Vyas <jaldhar at braincells.com>'
+abstract: DBIx::Class Authentication Driver
+license: perl
+requires:
+  CGI::Application::Plugin::Authentication: 0.06
+  DBIx::Class: 0
+recommends:
+  CGI::Application::Plugin::Session: 0
+  DBD::SQLite: 0
+  Digest::MD5: 0
+  Module::Signature: 0
+  Test::Pod: 1.14
+  Test::Pod::Coverage: 1.04
+build_requires:
+  CGI: 0
+  CGI::Application::Plugin::Authentication: 0.06
+  DBIx::Class: 0
+  File::Path: 0
+  Test::More: 0
+provides:
+  CGI::Application::Plugin::Authentication::Driver::DBIC:
+    file: lib/CGI/Application/Plugin/Authentication/Driver/DBIC.pm
+    version: 0.02
+generated_by: Module::Build version 0.26
diff --git a/driver-dbic/Makefile.PL b/driver-dbic/Makefile.PL
new file mode 100644
index 0000000..418e312
--- /dev/null
+++ b/driver-dbic/Makefile.PL
@@ -0,0 +1,17 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.03
+use ExtUtils::MakeMaker;
+WriteMakefile
+(
+          'NAME' => 'CGI::Application::Plugin::Authentication::Driver::DBIC',
+          'VERSION_FROM' => 'lib/CGI/Application/Plugin/Authentication/Driver/DBIC.pm',
+          'PREREQ_PM' => {
+                           'CGI' => '0',
+                           'CGI::Application::Plugin::Authentication' => '0.06',
+                           'DBIx::Class' => '0',
+                           'File::Path' => '0',
+                           'Test::More' => '0'
+                         },
+          'INSTALLDIRS' => 'site',
+          'PL_FILES' => {}
+        )
+;
diff --git a/driver-dbic/README b/driver-dbic/README
new file mode 100644
index 0000000..043cfba
--- /dev/null
+++ b/driver-dbic/README
@@ -0,0 +1,75 @@
+CGI-Application-Plugin-Authentication-Driver-DBIC 0.02
+======================================================
+
+This is a driver for CGI::Application::Plugin::Authentication which in turn is
+a plugin for the CGI::Application framework.  It allows you to authenticate a
+user against a database accessed using DBIx::Class.
+
+
+INSTALLATION
+
+If you have the Module::Signature module installed, you can verify the
+integrity of this distribution by typing:
+
+    cpansign -v
+
+Then to install this module type the following:
+
+    perl Build.PL
+    ./Build
+    ./Build test
+    ./Build install
+
+    or
+               
+    perl Makefile.PL
+    make
+    make test
+    make install                           
+                           
+DEPENDENCIES
+
+This module requires these other modules:
+
+CGI-Application-Plugin-Authentication 0.06
+DBIx-Class
+
+At build time you will need the above modules plus the following if you want
+to run all the tests
+
+CGI-Application-Plugin-Session
+DBD-SQLite 
+Test-Pod 1.14
+Test-Pod-Coverage 1.04
+            
+They are all available on CPAN (http://www.cpan.org)
+
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the perldoc command.
+
+    perldoc CGI::Application::Plugin::Authentication::Driver::DBIC
+
+You can also look for information at:
+
+    Search CPAN
+        http://search.cpan.org/dist/CGI-Application-Plugin-Authentication-Driver-DBIC
+
+    CPAN Request Tracker:
+        http://rt.cpan.org/NoAuth/Bugs.html?Dist=CGI-Application-Plugin-Authentication-Driver-DBIC
+
+    AnnoCPAN, annotated CPAN documentation:
+        http://annocpan.org/dist/CGI-Application-Plugin-Authentication-Driver-DBIC
+
+    CPAN Ratings:
+        http://cpanratings.perl.org/d/CGI-Application-Plugin-Authentication-Driver-DBIC
+
+COPYRIGHT AND LICENCE
+
+By Jaldhar H. Vyas
+
+Copyright (C) 2007, Consolidated Braincells Inc.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
diff --git a/driver-dbic/SIGNATURE b/driver-dbic/SIGNATURE
new file mode 100644
index 0000000..75dd48b
--- /dev/null
+++ b/driver-dbic/SIGNATURE
@@ -0,0 +1,45 @@
+This file contains message digests of all files listed in MANIFEST,
+signed via the Module::Signature module, version 0.55.
+
+To verify the content in this distribution, first make sure you have
+Module::Signature installed, then type:
+
+    % cpansign -v
+
+It will check each file's integrity, as well as the signature's
+validity.  If "==> Signature verified OK! <==" is not displayed,
+the distribution may already have been compromised, and you should
+not run its Makefile.PL or Build.PL.
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+SHA1 42c17c1e307e3183117b84352a3b70c8e3c035f1 .cvsignore
+SHA1 704d64a3eeb5ddef5cda59d17d4b3f6e5e1dfa34 Build.PL
+SHA1 dc6b2f6fb6baeb51d2392e701552c681c742caab Changes
+SHA1 77cd321c8e699deddf7d612ad787ec5fe67c413e MANIFEST
+SHA1 53bdb7441dbf19c3db8f36ff9bfcb65400592193 MANIFEST.SKIP
+SHA1 fb6fdc457b25bf9e174444298a4567e552b61755 META.yml
+SHA1 780e1c1f66435de76c13fe7da9725835a6ca71b6 Makefile.PL
+SHA1 a869c5487c8d01e77afdceacf8dbb85f7a67b879 README
+SHA1 648394bf7762a926e183ca67a277b4684b1a5c02 lib/CGI/Application/Plugin/Authentication/Driver/DBIC.pm
+SHA1 4aeb184c9bed26ab6c3be1ebdb8470c0cb353b1f t/00-signature.t
+SHA1 6c272658d5e7233f6f0533624f3f3ad363e753f8 t/01-load.t
+SHA1 0bfd45570e209cf5b890842063ca62f4f16115c4 t/authenticate.t
+SHA1 5ac4058770cdeefd578d37db0ce4d4eec466e680 t/authenticate_crypt.t
+SHA1 ebb0dbc2c973b7aefd95e97e2b6390efb27c4942 t/authenticate_md5.t
+SHA1 29d4d5384348a421d48f507d6ef91593decbc0e4 t/lib/TestAppAuthMD5.pm
+SHA1 fdd073ce1268c9f35733a2966b9a697445c91d5c t/lib/TestAppAuthPlain.pm
+SHA1 fe200cd23454c65304a7a395d1549c7083312792 t/lib/TestAppAuthcrypt.pm
+SHA1 b4761bbb78010c165fc1a1de85cc59691069ea2c t/lib/TestAppAuthenticate.pm
+SHA1 ace930587c54726d3e52647c7dae438bfc195157 t/lib/TestDB.pm
+SHA1 7f6ac3e2054235885d53ee80c0948ed24bd6e356 t/lib/TestDB/Users.pm
+SHA1 a4914ed51d6bac81f9c8e6867564b8d1f31996ca t/pod-coverage.t
+SHA1 79175c432b5b97852fd9db39092ca37d8eb38d47 t/pod.t
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD8DBQFGXPESIN9eM6kfjroRAp16AKCgw/FPKzK8mEc4jYLXlEBe07PaHACg74N0
+XVXGWFAtA8qKHFfE341i934=
+=8ktL
+-----END PGP SIGNATURE-----
diff --git a/driver-dbic/lib/CGI/Application/Plugin/Authentication/Driver/DBIC.pm b/driver-dbic/lib/CGI/Application/Plugin/Authentication/Driver/DBIC.pm
new file mode 100644
index 0000000..3673a8a
--- /dev/null
+++ b/driver-dbic/lib/CGI/Application/Plugin/Authentication/Driver/DBIC.pm
@@ -0,0 +1,207 @@
+package CGI::Application::Plugin::Authentication::Driver::DBIC;
+
+use warnings;
+use strict;
+use base 'CGI::Application::Plugin::Authentication::Driver';
+
+=head1 NAME
+
+CGI::Application::Plugin::Authentication::Driver::DBIC - DBIx::Class Authentication Driver
+
+=head1 VERSION
+
+Version 0.02
+
+=cut
+
+our $VERSION = '0.02';
+
+=head1 SYNOPSIS
+
+ use base qw(CGI::Application);
+ use CGI::Application::Plugin::Authentication;
+    
+ __PACKAGE__->authen->config( 
+     DRIVER => [ 
+        'DBIC',
+        SCHEMA => My::DBIC->connect($dsn), # or existing $schema object
+        CLASS => 'Users', # = My::DBIC::Users
+        FIELD_METHODS => [qw(user MD5:passphrase)]
+     ],
+     CREDENTIALS => [qw(auth_username auth_password)],
+ );
+
+=head1 DESCRIPTION
+
+This Authentication driver uses the L<DBIx::Class> module to allow you to 
+authenticate against any I<DBIx::Class> class.  
+
+=head1 PARAMETERS
+
+The I<DBIx::Class> authentication driver accepts the following required
+parameters.
+
+=over 4
+
+=item SCHEMA (required)
+
+Specifies the I<DBIx::Class::Schema> object to use for authentication. 
+This class must be loaded prior to use.
+
+=item CLASS (required)
+
+Specifies the I<DBIx::Class> class within the schema which contains 
+authentication information.
+
+=item FIELD_METHODS (required)
+
+FIELD_METHODS is an arrayref of the methods in the I<DBIx::Class> class
+specified by CLASS to be used during authentication. The order of these
+methods needs to match the order of the CREDENTIALS. For example, if
+CREDENTIALS is set to: 
+
+  CREDENTIALS => [qw(auth_user auth_domain auth_password)]
+  
+Then FIELD_METHODS must be set to:
+  
+  FIELD_METHODS => [qw(userid domain password)]
+    
+FIELD_METHODS supports filters as specified by 
+L<CGI::Application::Plugin::Authentication::Driver>
+
+=back
+    
+=head1 METHODS
+
+=head2 verify_credentials
+
+This method will test the provided credentials against the values found in 
+the database, according to the Driver configuration.
+
+=cut
+
+sub verify_credentials {
+    my $self = shift;
+    my @creds = @_;
+
+    my @_options = $self->options;
+    die "The Class::DBIx driver requires a hash of options" if @_options % 2;
+    my %options = @_options;
+
+    my $schema = $options{SCHEMA};
+    die "SCHEMA option must be set." 
+        unless($schema);
+    die "SCHEMA must be a DBIx::Class::Schema." 
+        unless($schema->isa('DBIx::Class::Schema'));
+
+    my $class = $options{CLASS};
+    die "CLASS option must be set." unless($class);
+
+    return unless(scalar(@creds) eq scalar(@{$options{FIELD_METHODS}}));
+
+    my @crednames=@{$self->authen->credentials};
+
+    my %search;
+    my %compare;
+    my $i=0;
+
+    # There's a lot of remapping lists/arrays into hashes here
+    # Most of this is due to needing a hash to perform a search,
+    # and another hash to perform comparisions if the search is
+    # encrypted. Also verify that columns that exist have been specified.
+    for(@{$options{FIELD_METHODS}}) {
+        $search{$_} = $creds[$i] unless /:/;
+        $compare{$_} = $creds[$i] if /:/;
+        my $column = $self->strip_field_names($_);
+        die "Column $column not in ", $schema->class($class) 
+            unless($schema->class($class)->can($column));
+        $i++;
+    }
+
+    my @users = $schema->resultset($class)->search( %search );
+    return unless(@users);
+
+    # We want to return the value of the first column specified.
+    # Could probably just return $creds[0] as that value should match
+    # but I've chosen to return what's in the DB.
+    my $field = ( @{ $options{FIELD_METHODS} } )[0];
+    if (%compare) {
+        foreach my $encoded ( keys(%compare) ) {
+            my $column = $self->strip_field_names($encoded);
+            # No point checking the rest of the columns if any of the encoded 
+            #ones do not match.
+            return
+                unless (
+                    $self->check_filtered(
+                    $encoded, $compare{$encoded}, $users[0]->$column
+                )
+            );
+        }
+    }
+    # If we've made it this far, we have a valid user. Set the user object and
+    # Return the value of the first credentail.
+    return $users[0]->$field;
+}
+
+=head1 SEE ALSO
+
+L<CGI::Application::Plugin::Authentication::Driver>, 
+L<CGI::Application::Plugin::Authentication>, perl(1)
+
+=head1 BUGS
+
+Please report any bugs or feature requests to
+C<bug-cgi-application-plugin-authentication-driver-dbic at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CGI-Application-Plugin-Authentication-Driver-DBIC>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc CGI::Application::Plugin::Authentication::Driver::DBIC
+
+You can also look for information at:
+
+=over 4
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/CGI-Application-Plugin-Authentication-Driver-DBIC>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/CGI-Application-Plugin-Authentication-Driver-DBIC>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=CGI-Application-Plugin-Authentication-Driver-DBIC>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/CGI-Application-Plugin-Authentication-Driver-DBIC>
+
+=back
+
+=head1 THANKS
+
+Cees Hek for I<CGI::Application::Plugin::Authentication>
+
+Shawn Sorichetti for I<CGI::Application::Plugin::Authentication::Driver::CDBI>
+which this module is shamelessly copied from.
+
+=head1 AUTHOR
+
+Jaldhar H. Vyas, C<< <jaldhar at braincells.com> >>
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2007, Consolidated Braincells Inc., all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1; # End of CGI::Application::Plugin::Authentication::Driver::DBIC
diff --git a/driver-dbic/t/00-signature.t b/driver-dbic/t/00-signature.t
new file mode 100644
index 0000000..d828bdd
--- /dev/null
+++ b/driver-dbic/t/00-signature.t
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More;
+
+if (!$ENV{TEST_SIGNATURE}) {
+    plan skip_all => 
+      "Set the environment variable TEST_SIGNATURE to enable this test.";
+}
+elsif (!eval { require Module::Signature; 1 }) {
+    plan skip_all => 
+      "Next time around, consider installing Module::Signature, ".
+      "so you can verify the integrity of this distribution.";
+}
+elsif ( !-e 'SIGNATURE' ) {
+    plan skip_all => "SIGNATURE not found";
+}
+elsif ( -s 'SIGNATURE' == 0 ) {
+    plan skip_all => "SIGNATURE file empty";
+}
+elsif (!eval { require Socket; Socket::inet_aton('pgp.mit.edu') }) {
+    plan skip_all => "Cannot connect to the keyserver to check module ".
+                     "signature";
+}
+else {
+    plan tests => 1;
+}
+
+my $ret = Module::Signature::verify();
+SKIP: {
+    skip "Module::Signature cannot verify", 1 
+      if $ret eq Module::Signature::CANNOT_VERIFY();
+
+    cmp_ok $ret, '==', Module::Signature::SIGNATURE_OK(), "Valid signature";
+}
diff --git a/driver-dbic/t/01-load.t b/driver-dbic/t/01-load.t
new file mode 100644
index 0000000..b0b0af0
--- /dev/null
+++ b/driver-dbic/t/01-load.t
@@ -0,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+	use_ok( 'CGI::Application::Plugin::Authentication::Driver::DBIC' );
+}
+
+diag( "Testing CGI::Application::Plugin::Authentication::Driver::DBIC $CGI::Application::Plugin::Authentication::Driver::DBIC::VERSION, Perl $], $^X" );
diff --git a/driver-dbic/t/authenticate.t b/driver-dbic/t/authenticate.t
new file mode 100644
index 0000000..8b558c3
--- /dev/null
+++ b/driver-dbic/t/authenticate.t
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+use Test::More;
+
+eval "use CGI::Application::Plugin::Session";
+plan skip_all => "CGI::Application::Plugin::Session required for this test"
+  if $@;
+
+eval "use DBD::SQLite";
+plan skip_all => "DBD::SQLite required for this test"
+  if $@;
+
+plan tests => 8;
+
+use strict;
+use warnings;
+
+use CGI ();
+use lib qw( ./t/lib );
+use TestAppAuthenticate;
+use TestDB;
+use File::Path;
+
+mkpath(['t/db']);
+TestDB->setuptables;
+
+$ENV{CGI_APP_RETURN_ONLY} = 1;
+
+# Missing Credentials
+my $query = 
+    CGI->new( { auth_username => 'user1', rm => 'two' } );
+
+my $cgiapp = TestAppAuthenticate->new( QUERY => $query );
+
+my $results = $cgiapp->run;
+
+ok(!$cgiapp->authen->is_authenticated,'missing credentials - login failure');
+is( $cgiapp->authen->username, undef, 'missing credentials - username not set' );
+
+# Successful Login
+$query =
+ CGI->new( { auth_username => 'user1', auth_password => '123', rm => 'two' } );
+
+$cgiapp = TestAppAuthenticate->new( QUERY => $query );
+$results = $cgiapp->run;
+
+ok($cgiapp->authen->is_authenticated,'successful login');
+is( $cgiapp->authen->username, 'user1', 'successful login - username set' );
+is( $cgiapp->authen->login_attempts, 0, "successful login - failed login count" );
+
+# Bad user or password
+$query =
+ CGI->new( { auth_username => 'user2', auth_password => '123', rm => 'two' } );
+$cgiapp = TestAppAuthenticate->new( QUERY => $query );
+$results = $cgiapp->run;
+
+ok(!$cgiapp->authen->is_authenticated,'login failure');
+is( $cgiapp->authen->username, undef, "login failure - username not set" );
+is( $cgiapp->authen->login_attempts, 1, "login failure - failed login count" );
+
+END {
+  rmtree(['t/db']);
+}
diff --git a/driver-dbic/t/authenticate_crypt.t b/driver-dbic/t/authenticate_crypt.t
new file mode 100644
index 0000000..b849219
--- /dev/null
+++ b/driver-dbic/t/authenticate_crypt.t
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+use Test::More;
+
+eval "use CGI::Application::Plugin::Session";
+plan skip_all => "CGI::Application::Plugin::Session required for this test"
+  if $@;
+
+eval "use DBD::SQLite";
+plan skip_all => "DBD::SQLite required for this test"
+  if $@;
+
+plan tests => 3;
+
+use strict;
+use warnings;
+
+use CGI ();
+use lib qw( ./t/lib );
+use TestAppAuthcrypt;
+use TestDB;
+use File::Path;
+
+mkpath(['t/db']);
+TestDB->setuptables;
+
+$ENV{CGI_APP_RETURN_ONLY} = 1;
+
+my $query = CGI->new(
+  {
+    auth_username => 'usercrypt',
+    auth_password => 'testpassword',
+    rm            => 'two'
+  }
+);
+
+my $cgiapp  = TestAppAuthcrypt->new( QUERY => $query );
+my $results = $cgiapp->run;
+
+ok( $cgiapp->authen->is_authenticated, 'successful login crypt' );
+is( $cgiapp->authen->username, 'usercrypt',
+  'successful login crypt - username set' );
+is( $cgiapp->authen->login_attempts,
+  0, "successful login crypt - failed login count" );
+
+END {
+  rmtree(['t/db']);
+}
diff --git a/driver-dbic/t/authenticate_md5.t b/driver-dbic/t/authenticate_md5.t
new file mode 100644
index 0000000..812daaf
--- /dev/null
+++ b/driver-dbic/t/authenticate_md5.t
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+use Test::More;
+
+eval "use CGI::Application::Plugin::Session";
+plan skip_all => "CGI::Application::Plugin::Session required for this test"
+  if $@;
+
+eval "use Digest::MD5";
+plan skip_all => "Digest::MD5 required for this test"
+  if $@;
+
+eval "use DBD::SQLite";
+plan skip_all => "DBD::SQLite required for this test"
+  if $@;
+
+plan tests => 3;
+
+use strict;
+use warnings;
+
+use CGI ();
+use lib qw( ./t/lib );
+use TestAppAuthMD5;
+use TestDB;
+use File::Path;
+
+mkpath(['t/db']);
+TestDB->setuptables;
+
+$ENV{CGI_APP_RETURN_ONLY} = 1;
+
+my $query =
+  CGI->new(
+  { auth_username => 'usermd5', auth_password => 'testpassword', rm => 'two' }
+  );
+
+my $cgiapp  = TestAppAuthMD5->new( QUERY => $query );
+my $results = $cgiapp->run;
+
+ok( $cgiapp->authen->is_authenticated, 'successful login MD5' );
+is( $cgiapp->authen->username, 'usermd5', 'successful login MD5 - username set' );
+is( $cgiapp->authen->login_attempts,
+  0, "successful login MD5 - failed login count" );
+
+END {
+  rmtree(['t/db']);
+}
diff --git a/driver-dbic/t/lib/TestAppAuthMD5.pm b/driver-dbic/t/lib/TestAppAuthMD5.pm
new file mode 100644
index 0000000..1b0c897
--- /dev/null
+++ b/driver-dbic/t/lib/TestAppAuthMD5.pm
@@ -0,0 +1,37 @@
+package TestAppAuthMD5;
+
+use base qw(CGI::Application);
+use CGI::Application::Plugin::Session;
+use CGI::Application::Plugin::Authentication;
+use lib 't/lib';
+use TestDB;
+
+my %config = (
+  DRIVER => [
+    'DBIC',
+    SCHEMA        => TestDB->connect('dbi:SQLite:t/db/users.db'),
+    CLASS         => 'Users',
+    FIELD_METHODS => [qw( user MD5:passphrase )]
+  ],
+  CREDENTIALS => [qw( auth_username auth_password )],
+  STORE       => 'Session',
+);
+
+__PACKAGE__->authen->config(%config);
+
+sub setup {
+  my $self = shift;
+  $self->start_mode('one');
+  $self->run_modes([qw( one two )]);
+  $self->authen->protected_runmodes(qw( two ));
+}
+
+sub one {
+  my $self = shift;
+}
+
+sub two {
+  my $self = shift;
+}
+
+1;
diff --git a/driver-dbic/t/lib/TestAppAuthPlain.pm b/driver-dbic/t/lib/TestAppAuthPlain.pm
new file mode 100644
index 0000000..2ab554d
--- /dev/null
+++ b/driver-dbic/t/lib/TestAppAuthPlain.pm
@@ -0,0 +1,36 @@
+package TestAppAuthPlain;
+
+use base qw(CGI::Application);
+use CGI::Application::Plugin::Session;
+use CGI::Application::Plugin::Authentication;
+use lib 't/lib';
+use TestDB;
+
+my %config = (
+  DRIVER => [
+    'DBIC',
+    SCHEMA        => TestDB->connect('dbi:SQLite:t/db/users.db'),
+    CLASS         => 'Users',
+    FIELD_METHODS => [qw(user plain:passphrase)]
+  ],
+  CREDENTIALS => [qw( auth_username auth_password )],
+  STORE       => 'Session',
+);
+
+__PACKAGE__->auth->config(%config);
+
+sub setup {
+  my $self = shift;
+  $self->start_mode('one');
+  $self->run_modes(qw( one two ));
+  $self->auth->protected_runmodes(qw( two ));
+}
+
+sub one {
+  my $self = shift;
+}
+
+sub two {
+  my $self = shift;
+}
+1;
diff --git a/driver-dbic/t/lib/TestAppAuthcrypt.pm b/driver-dbic/t/lib/TestAppAuthcrypt.pm
new file mode 100644
index 0000000..65b6e4c
--- /dev/null
+++ b/driver-dbic/t/lib/TestAppAuthcrypt.pm
@@ -0,0 +1,36 @@
+package TestAppAuthcrypt;
+
+use base qw(CGI::Application);
+use CGI::Application::Plugin::Session;
+use CGI::Application::Plugin::Authentication;
+use lib 't/lib';
+use TestDB;
+
+my %config = (
+  DRIVER => [
+    'DBIC',
+    SCHEMA        => TestDB->connect('dbi:SQLite:t/db/users.db'),
+    CLASS         => 'Users',
+    FIELD_METHODS => [qw( user crypt:passphrase )]
+  ],
+  CREDENTIALS => [qw( auth_username auth_password )],
+  STORE       => 'Session',
+);
+
+__PACKAGE__->authen->config(%config);
+
+sub setup {
+  my $self = shift;
+  $self->start_mode('one');
+  $self->run_modes([qw( one two )]);
+  $self->authen->protected_runmodes(qw( two ));
+}
+
+sub one {
+  my $self = shift;
+}
+
+sub two {
+  my $self = shift;
+}
+1;
diff --git a/driver-dbic/t/lib/TestAppAuthenticate.pm b/driver-dbic/t/lib/TestAppAuthenticate.pm
new file mode 100644
index 0000000..aea58d2
--- /dev/null
+++ b/driver-dbic/t/lib/TestAppAuthenticate.pm
@@ -0,0 +1,36 @@
+package TestAppAuthenticate;
+
+use base qw(CGI::Application);
+use CGI::Application::Plugin::Session;
+use CGI::Application::Plugin::Authentication;
+use lib 't/lib';
+use TestDB;
+
+__PACKAGE__->authen->config(
+  DRIVER => [
+    'DBIC',
+    SCHEMA        => TestDB->connect('dbi:SQLite:t/db/users.db'), 
+    CLASS         => 'Users',
+    FIELD_METHODS => [qw( user passphrase )]
+  ],
+  CREDENTIALS => [qw( auth_username auth_password )],
+  STORE       => 'Session',
+);
+
+
+sub setup {
+  my $self = shift;
+  $self->start_mode('one');
+  $self->run_modes([qw( one two )]);
+  $self->authen->protected_runmodes(qw( two ));
+}
+
+sub one {
+  my $self = shift;
+}
+
+sub two {
+  my $self = shift;
+}
+1;
+
diff --git a/driver-dbic/t/lib/TestDB.pm b/driver-dbic/t/lib/TestDB.pm
new file mode 100644
index 0000000..d3a91ea
--- /dev/null
+++ b/driver-dbic/t/lib/TestDB.pm
@@ -0,0 +1,16 @@
+package TestDB;
+
+use base 'DBIx::Class::Schema';
+
+__PACKAGE__->load_classes(qw/ Users /);
+
+sub setuptables {
+   my $conn =  __PACKAGE__->connect('dbi:SQLite:t/db/users.db'); 
+
+    foreach (__PACKAGE__->sources) {
+        __PACKAGE__ ->class($_)->setuptable($conn->storage->dbh);
+    }             
+}
+
+1;
+
diff --git a/driver-dbic/t/lib/TestDB/Users.pm b/driver-dbic/t/lib/TestDB/Users.pm
new file mode 100644
index 0000000..1c084b4
--- /dev/null
+++ b/driver-dbic/t/lib/TestDB/Users.pm
@@ -0,0 +1,29 @@
+package TestDB::Users;
+use base 'DBIx::Class';
+
+__PACKAGE__->load_components(qw/Core/);
+__PACKAGE__->table('users');
+#__PACKAGE__->add_columns( All => qw[user passphrase] );
+__PACKAGE__->add_columns(qw[ user passphrase ]);
+
+sub setuptable {
+    my ($self, $dbh) = @_;
+    
+    local $/ = "\n\n";
+    $dbh->do($_) for <DATA>;
+}
+
+1;
+
+__DATA__
+CREATE TABLE users (
+  user varchar(16) PRIMARY KEY,
+  passphrase varchar(25)
+);
+
+INSERT INTO users VALUES ('user1','123');
+
+INSERT INTO users VALUES ('usermd5','e16b2ab8d12314bf4efbd6203906ea6c');
+
+INSERT INTO users VALUES ('usercrypt','111ukgxvMW4Lw');
+
diff --git a/driver-dbic/t/pod-coverage.t b/driver-dbic/t/pod-coverage.t
new file mode 100644
index 0000000..0ac0cda
--- /dev/null
+++ b/driver-dbic/t/pod-coverage.t
@@ -0,0 +1,8 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+eval 'use Test::Pod::Coverage 1.04';
+plan skip_all => 'Test::Pod::Coverage 1.04 required for testing POD coverage' if $@;
+all_pod_coverage_ok();
diff --git a/driver-dbic/t/pod.t b/driver-dbic/t/pod.t
new file mode 100644
index 0000000..7e377d8
--- /dev/null
+++ b/driver-dbic/t/pod.t
@@ -0,0 +1,8 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+eval 'use Test::Pod 1.14';
+plan skip_all => 'Test::Pod 1.14 required for testing POD' if $@;
+all_pod_files_ok();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcgi-application-plugin-authentication-perl.git



More information about the Pkg-perl-cvs-commits mailing list