2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Copyright 2005 The Apache Software Foundation or its licensors, as
10 Licensed under the Apache License, Version 2.0 (the "License");
11 you may not use this file except in compliance with the License.
12 You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
23 <modulesynopsis metafile="mod_authn_dbd.xml.meta">
25 <name>mod_authn_dbd</name>
26 <description>User authentication using an SQL database</description>
27 <status>Extension</status>
28 <sourcefile>mod_authn_dbd.c</sourcefile>
29 <identifier>authn_dbd_module</identifier>
30 <compatibility>Available in Apache 2.1 and later</compatibility>
33 <p>This module provides authentication front-ends such as
34 <module>mod_auth_digest</module> and <module>mod_auth_basic</module>
35 to authenticate users by looking up users in SQL tables.
36 Similar functionality is provided by, for example,
37 <module>mod_authn_file</module>.</p>
38 <p>This module relies on <module>mod_dbd</module> to specify
39 the backend database driver and connection parameters, and
40 manage the database connections.</p>
42 <p>When using <module>mod_auth_basic</module> or
43 <module>mod_auth_digest</module>, this module is invoked via the
44 <directive module="mod_auth_basic">AuthBasicProvider</directive> or
45 <directive module="mod_auth_digest">AuthDigestProvider</directive>
46 with the <code>dbd</code> value.</p>
49 <seealso><directive module="core">AuthName</directive></seealso>
50 <seealso><directive module="core">AuthType</directive></seealso>
52 <directive module="mod_auth_basic">AuthBasicProvider</directive>
55 <directive module="mod_auth_digest">AuthDigestProvider</directive>
57 <seealso><directive module="mod_dbd">DBDriver</directive></seealso>
58 <seealso><directive module="mod_dbd">DBDParams</directive></seealso>
60 <section id="example">
61 <title>Configuration Example</title>
62 <p>This simple example shows use of this module in the context of
63 the Authentication and DBD frameworks.</p>
67 #Use the PostgreSQL driver
68 <code>DBDriver pgsql</code>
70 #Connection string: database name and login credentials
71 <code>DBDParams "dbname=htpasswd user=apache password=xxxxxx"</code>
73 #Parameters for Connection Pool Management
79 #Authentication Section
80 <code><Directory /usr/www/myhost/private></code>
82 #mod_auth configuration for authn_dbd
85 AuthBasicProvider dbd</code>
88 <code>Require valid-user</code>
90 #SQL query to verify a user
91 #(note: DBD drivers recognise both stdio-like %s and native syntax)
92 <code>AuthDBDUserPWQuery "select password from authn where username = %s"
93 </Directory></code>
99 <name>AuthDBDUserPWQuery</name>
100 <description>SQL query to look up a password for a user</description>
101 <syntax>AuthDBDUserPWQuery <var>query</var></syntax>
102 <contextlist><context>directory</context>
106 <p>The <directive>AuthDBDUserPWQuery</directive> specifies an
107 SQL query to look up a password for a specified user.
108 The query must take a single string (typically SQL varchar)
109 argument (username), and return a single value (encrypted password).
112 AuthDBDUserPWQuery "SELECT password FROM authn WHERE username = %s"
119 <name>AuthDBDUserRealmQuery</name>
120 <description>SQL query to look up a password hash for a user and realm.
122 <syntax>AuthDBDUserRealmQuery <var>query</var></syntax>
123 <contextlist><context>directory</context>
127 <p>The <directive>AuthDBDUserRealmQuery</directive> specifies an
128 SQL query to look up a password for a specified user and realm.
129 The query must take two string (typically SQL varchar) arguments
130 (username and realm), and return a single value (encrypted password).
133 AuthDBDUserRealmQuery "SELECT password FROM authn
134 WHERE username = %s AND realm = %s"