]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_authn_dbd.xml
Adding updated mod_ssl HOWTO to the website
[apache] / docs / manual / mod / mod_authn_dbd.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Copyright 2005 The Apache Software Foundation or its licensors, as
8  applicable.
9
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
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
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.
21 -->
22
23 <modulesynopsis metafile="mod_authn_dbd.xml.meta">
24
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>
31
32 <summary>
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>
41
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>
47 </summary>
48
49 <seealso><directive module="core">AuthName</directive></seealso>
50 <seealso><directive module="core">AuthType</directive></seealso>
51 <seealso>
52   <directive module="mod_auth_basic">AuthBasicProvider</directive>
53 </seealso>
54 <seealso>
55   <directive module="mod_auth_digest">AuthDigestProvider</directive>
56 </seealso>
57 <seealso><directive module="mod_dbd">DBDriver</directive></seealso>
58 <seealso><directive module="mod_dbd">DBDParams</directive></seealso>
59
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>
64 <example><pre>
65 #Database Management
66
67 #Use the PostgreSQL driver
68 <code>DBDriver pgsql</code>
69
70 #Connection string: database name and login credentials
71 <code>DBDParams "dbname=htpasswd user=apache password=xxxxxx"</code>
72
73 #Parameters for Connection Pool Management
74 <code>DBDMin  1
75 DBDKeep 2
76 DBDMax  10
77 DBDExptime 60</code>
78
79 #Authentication Section
80 <code>&lt;Directory /usr/www/myhost/private&gt;</code>
81
82     #mod_auth configuration for authn_dbd
83     <code>AuthType Basic
84     AuthName "My Server"
85     AuthBasicProvider dbd</code>
86
87     #authz configuration
88     <code>Require valid-user</code>
89
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 &lt;/Directory&gt;</code>
94 </pre>
95 </example>
96 </section>
97
98 <directivesynopsis>
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>
103 </contextlist>
104
105 <usage>
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).
110     </p>
111     <example>
112     AuthDBDUserPWQuery "SELECT password FROM authn WHERE username = %s"
113     </example>
114
115 </usage>
116 </directivesynopsis>
117
118 <directivesynopsis>
119 <name>AuthDBDUserRealmQuery</name>
120 <description>SQL query to look up a password hash for a user and realm.
121 </description>
122 <syntax>AuthDBDUserRealmQuery <var>query</var></syntax>
123 <contextlist><context>directory</context>
124 </contextlist>
125
126 <usage>
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).
131     </p>
132     <example>
133     AuthDBDUserRealmQuery "SELECT password FROM authn
134                               WHERE username = %s AND realm = %s"
135     </example>
136
137 </usage>
138 </directivesynopsis>
139
140 </modulesynopsis>