CGI-Application-Plugin-Authentication-Driver-CDBI

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

      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@coloredblocks.net>"

BUGS

lib/CGI/Application/Plugin/Authentication/Driver/CDBI.pm  view on Meta::CPAN


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}}) {

t/authenticate.t  view on Meta::CPAN

$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' );

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.457 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )