Author image Geoffrey Young


Apache::AuthDigestDBI - Authentication and Authorization via Perl's DBI, supporting both Basic and Digest Authentication


 # Configuration in httpd.conf or

 PerlModule Apache::AuthDigestDBI

 # Authentication and Authorization in .htaccess:

 AuthName DBI
 AuthType Digest

 PerlAuthenHandler Apache::AuthDigestDBI::authen
 PerlAuthzHandler  Apache::AuthDigestDBI::authz

 PerlSetVar Auth_DBI_data_source   dbi:driver:dsn
 PerlSetVar Auth_DBI_username      db_username
 PerlSetVar Auth_DBI_password      db_password
 #DBI->connect($data_source, $username, $password)

 PerlSetVar Auth_DBI_pwd_table     users
 PerlSetVar Auth_DBI_uid_field     username
 PerlSetVar Auth_DBI_pwd_field     password
 # authentication: SELECT pwd_field FROM pwd_table WHERE uid_field=$user
 PerlSetVar Auth_DBI_grp_field     groupname
 # authorization: SELECT grp_field FROM pwd_table WHERE uid_field=$user

 require valid-user
 require user   user_1  user_2 ...
 require group group_1 group_2 ...

The AuthType may be Digest or Basic. It will 'fallback' to Basic if the client ignores the request for Digest authentication. The password must not be encrypted for Digest authentication and the fallback to Basic. For Basic authentication, passwords may be encrypted.

You may use one or more valid require lines. For a single require line with the requirement 'valid-user' or with the requirements 'user user_1 user_2 ...' it is sufficient to use only the authentication handler.


This is a hacked up version Apache::AuthDBI that uses Apache::AuthDigest to do Digest authentication. Please see the docs for Apache::AuthDBI for full usage.


Note that this module requires Apache::AuthDBI and Apache::AuthDigest.


Apache::AuthDBI, Apache::AuthDigest::API, Apache, mod_perl, DBI


The password must not be encrypted for use with Digest authentication.

When Digest authentication is requested, it accepts Basic authentication. (This isn't a bug, except that you cannot shut this behavior off.)


  • Apache::AuthDigestDBI variation by Robert Giseburt <>

  • Apache::AuthDBI by Edmund Mergl

  • mod_perl by Doug MacEachern <>

  • DBI by Tim Bunce <>


The Apache::AuthDigestDBI module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 890:

'=item' outside of any '=over'

Around line 904:

You forgot a '=back' before '=head1'