Authen::Simple::DBI(3pm)

Authen::Simple::DBI3pm

Simple dbi authentication

Usage

    use Authen::Simple::DBI;
    
    my $dbi = Authen::Simple::DBI->new(
        dsn       => 'dbi:SQLite:dbname=database.db',
        statement => 'SELECT password FROM users WHERE username = ?'
    );
    
    if ( $dbi->authenticate( $username, $password ) ) {
        # successfull authentication
    }
    
    # or as a mod_perl Authen handler
    PerlModule Apache::DBI
    PerlModule Authen::Simple::Apache
    PerlModule Authen::Simple::DBI
    PerlSetVar AuthenSimpleDBI_dsn       "dbi:SQLite:dbname=database.db"
    PerlSetVar AuthenSimpleDBI_statement "SELECT password FROM users WHERE username = ?"
    <Location /protected>
      PerlAuthenHandler Authen::Simple::DBI
      AuthType          Basic
      AuthName          "Protected Area"
      Require           valid-user
    </Location>

Overview

DBI authentication.

Methods

•

new

This method takes a hash of parameters. The following options are valid:

•

dsn

Database Source Name. Required.

    dsn => 'dbi:SQLite:dbname=database.db'
    dsn => 'dbi:mysql:database=database;host=localhost;'
•

statement

SQL statement. The statement must take a single string argument (username) and return a single value (password). Required.

    statement => 'SELECT password FROM users WHERE username = ?'
•

username

Database username.

    username => 'username'
•

password

Database password.

    password => 'secret'
•

log

Any object that supports "debug", "info", "error" and "warn".

    log => Log::Log4perl->get_logger('Authen::Simple::DBI')
•

authenticate( $username, $password )

Returns true on success and false on failure.

Releases

9 releases since Debian 5.0 (Lenny); the text changed 3 times.

  1. 5.0–8
  2. 9–10
  3. 11
  4. 12–13

Author

Christian Hansen "[email protected]"

From libauthen-simple-dbi-perl 0.2-4 in Debian 13 (Trixie). Parsed by carta from the page's man source.