"No DBD Authn configured!" with Apache, Digest Auth and DBD
I use mod_authn_dbd to check HTTP authentication credentials against a MySQL database. After switching from Basic to Digest authentication I got 500 errors and
No DBD Authn configured! in the server's error log. It took me a while to realize that it wasn't enough to change
AuthType Basic AuthBasicProvider dbd
AuthType Digest AuthDigestProvider dbd
but that I also need to change
AuthDBDUserPWQuery "SELECT … "
AuthDBDUserRealmQuery "SELECT … "
Apparently, digest auth requires a lookup by user and realm, whereas basic auth gets by on just looking up user. Both, digest and basic auth specify the realm and user name in clear text in the
Authorization header, so I don't know why
mod_authn_dbd behaves differently in each mode. Also I'd love to get a less cryptic error message. What's wrong with "AuthDBDUserRealmQuery undefined"?
Note that there is no need to add a realm condition to the WHERE clause of the actual SQL statement. This is because realm is the second parameter and will simply be ignored if there is no second placeholder (
?) in the query.