Apache2-AuthCookieDBImg

 view release on metacpan or  search on metacpan

lib/Apache2/AuthCookieDBImg.pm  view on Meta::CPAN

It should return a string consisting of ":field1:field2:field3"
(where each field is preceded by a colon).

The default implementation does nothing.

=back

=cut

sub extra_session_info ($$\@) {
    my ($self, $r, @credentials) = @_;
    return '';
}

#-------------------------------------------------------------------------------
# Take the credentials for a user and check that they match; if so, return
# a new session key for this user that can be stored in the cookie.
# If there is a problem, return a bogus session key.

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

    my $auth_name = $r->auth_name;

    # Username goes in credential_0
    my $user = shift @credentials;
    unless ( $user =~ /^.+$/ ) {
        $r->log_error( "Apache2::AuthCookieDBI: no username supplied for auth realm $auth_name", $r->uri );
        return undef;
    }
    # Password goes in credential_1
    my $password = shift @credentials;
    unless ( $password =~ /^.+$/ ) {
        $r->log_error( "Apache2::AuthCookieDBI: no password supplied for auth realm $auth_name", $r->uri );
        return undef;
    }

	 # CSA Patch - Use global var
	 # needed later for authen_sess_key
	 # to keep cookie alive
	 #
    # Extra data can be put in credential_2, _3, etc.
    # my @extra_data = @credentials;
	 @Extra_Data = @credentials;

    # get the configuration information.
    my %c = _dbi_config_vars $r;

    # get the crypted password from the users database for this user.
    my $dbh = DBI->connect( $c{ DBI_DSN },
                            $c{ DBI_user }, $c{ DBI_password } );
    unless ( defined $dbh ) {
        $r->log_error( "Apache2::AuthCookieDBI: couldn't connect to $c{ DBI_DSN } for auth realm $auth_name", $r->uri );
        return undef;



( run in 0.220 second using v1.01-cache-2.11-cpan-a5abf4f5562 )