1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>mod_auth_form - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.3</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_auth_form</h1>
24 <p><span>Available Languages: </span><a href="../en/mod/mod_auth_form.html" title="English"> en </a></p>
26 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Form authentication</td></tr>
27 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
28 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>auth_form_module</td></tr>
29 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_auth_form.c</td></tr></table>
32 <div class="warning"><h3>Warning</h3>
33 <p>Form authentication depends on the <code class="module"><a href="../mod/mod_session.html">mod_session</a></code>
34 modules, and these modules make use of HTTP cookies, and as such can fall
35 victim to Cross Site Scripting attacks, or expose potentially private
36 information to clients. Please ensure that the relevant risks have
37 been taken into account before enabling the session functionality on
41 <p>This module allows the use of an HTML login form to restrict access
42 by looking up users in the given providers. HTML forms require
43 significantly more configuration than the alternatives, however an
44 HTML login form can provide a much friendlier experience for end users.
47 <p>HTTP basic authentication is provided by
48 <code class="module"><a href="../mod/mod_auth_basic.html">mod_auth_basic</a></code>, and HTTP digest authentication is
49 provided by <code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code>. This module should
50 be combined with at least one authentication module
51 such as <code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code> and one authorization
52 module such as <code class="module"><a href="../mod/mod_authz_user.html">mod_authz_user</a></code>.</p>
54 <p>Once the user has been successfully authenticated, the user's login
55 details will be stored in a session provided by <code class="module"><a href="../mod/mod_session.html">mod_session</a></code>.
59 <div id="quickview"><h3 class="directives">Directives</h3>
61 <li><img alt="" src="../images/down.gif" /> <a href="#authformauthoritative">AuthFormAuthoritative</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#authformbody">AuthFormBody</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#authformdisablenostore">AuthFormDisableNoStore</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#authformfakebasicauth">AuthFormFakeBasicAuth</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#authformlocation">AuthFormLocation</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#authformloginsuccesslocation">AuthFormLoginSuccessLocation</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#authformlogoutlocation">AuthFormLogoutLocation</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#authformmethod">AuthFormMethod</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#authformmimetype">AuthFormMimetype</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#authformpassword">AuthFormPassword</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#authformprovider">AuthFormProvider</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#authformsitepassphrase">AuthFormSitePassphrase</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#authformsize">AuthFormSize</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#authformusername">AuthFormUsername</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#basicconfig">Basic Configuration</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#standalone">Standalone Login</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#inline">Inline Login</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#inlinepreservebody">Inline Login with Body Preservation</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#loggingout">Logging Out</a></li>
84 </ul><h3>See also</h3>
86 <li><code class="module"><a href="../mod/mod_session.html">mod_session</a></code></li>
87 <li><code class="directive"><a href="../mod/mod_authn_core.html#authname">AuthName</a></code></li>
88 <li><code class="directive"><a href="../mod/mod_authn_core.html#authtype">AuthType</a></code></li>
89 <li><code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code></li>
90 <li><code class="directive"><a href="../mod/mod_authz_core.html#match">Match</a></code></li>
91 <li><a href="../howto/auth.html">Authentication howto</a></li>
93 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
95 <h2><a name="basicconfig" id="basicconfig">Basic Configuration</a></h2>
97 <p>To protect a particular URL with <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code>, you need to
98 decide where you will store your <var>session</var>, and you will need to
99 decide what method you will use to authenticate. In this simple example, the
100 login details will be stored in a session based on
101 <code class="module"><a href="../mod/mod_session_cookie.html">mod_session_cookie</a></code>, and authentication will be attempted against
102 a file using <code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code>. If authentication is unsuccessful,
103 the user will be redirected to the form login page.</p>
105 <div class="example"><h3>Basic example</h3><p><code>
106 AuthFormProvider file<br />
107 AuthUserFile conf/passwd<br />
110 AuthFormLoginRequiredLocation http://example.com/login.html<br />
112 SessionCookieName session path=/<br />
113 SessionCryptoPassphrase secret<br />
116 <p>The directive <code class="directive"><a href="../mod/mod_authn_core.html#authtype">AuthType</a></code> will enable
117 the <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> authentication when set to the value <var>form</var>.
118 The directives <code class="directive"><a href="#authformprovider">AuthFormProvider</a></code> and
119 <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code> specify that usernames
120 and passwords should be checked against the chosen file.</p>
122 <p>The directives <code class="directive"><a href="../mod/mod_session.html#session">Session</a></code>,
123 <code class="directive"><a href="../mod/mod_session_cookie.html#sessioncookiename">SessionCookieName</a></code> and
124 <code class="directive"><a href="../mod/mod_session_crypto.html#sessioncryptopassphrase">SessionCryptoPassphrase</a></code> create an
125 encrypted session stored within an HTTP cookie on the browser. For more information
126 on the different options for configuring a session, read the documentation for
127 <code class="module"><a href="../mod/mod_session.html">mod_session</a></code>.</p>
129 <p>In the simple example above, a URL has been protected by
130 <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code>, but the user has yet to be given an opportunity to
131 enter their username and password. Options for doing so include providing a
132 dedicated standalone login page for this purpose, or for providing the login
134 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
135 <div class="section">
136 <h2><a name="standalone" id="standalone">Standalone Login</a></h2>
138 <p>The login form can be hosted as a standalone page, or can be provided inline on
141 <p>When configuring the login as a standalone page, unsuccessful authentication
142 attempts should be redirected to a login form created by the website for this purpose,
143 using the <code class="directive"><a href="#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></code>
144 directive. Typically this login page will contain an HTML form, asking the user to
145 provide their usename and password.</p>
147 <div class="example"><h3>Example login form</h3><p><code>
148 <form method="POST" action="/dologin.html"><br />
149 Username: <input type="text" name="httpd_username" value="" /><br />
150 Password: <input type="password" name="httpd_password" value="" /><br />
151 <input type="submit" name="login" value="Login" /><br />
155 <p>The part that does the actual login is handled by the <var>form-login-handler</var>.
156 The action of the form should point at this handler, which is configured within
157 Apache as follows:</p>
159 <div class="example"><h3>Form login handler example</h3><p><code>
160 <Location /dologin.html>
161 <span class="indent">
162 SetHandler form-login-handler<br />
163 AuthFormLoginRequiredLocation http://example.com/login.html<br />
164 AuthFormLoginSuccessLocation http://example.com/success.html<br />
165 AuthFormProvider file<br />
166 AuthUserFile conf/passwd<br />
170 SessionCookieName session path=/<br />
171 SessionCryptoPassphrase secret<br />
176 <p>The URLs specified by the
177 <code class="directive"><a href="#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></code> directive will typically
178 point to a page explaining to the user that their login attempt was unsuccessful, and they
179 should try again. The <code class="directive"><a href="#authformloginsuccesslocation">AuthFormLoginSuccessLocation</a></code>
180 directive specifies the URL the user should be redirected to upon successful login.</p>
182 <p>Alternatively, the URL to redirect the user to on success can be embedded within the login
183 form, as in the example below. As a result, the same <var>form-login-handler</var> can be
184 reused for different areas of a website.</p>
186 <div class="example"><h3>Example login form with location</h3><p><code>
187 <form method="POST" action="/dologin.html"><br />
188 <span class="indent">
189 Username: <input type="text" name="httpd_username" value="" /><br />
190 Password: <input type="password" name="httpd_password" value="" /><br />
191 <input type="submit" name="login" value="Login" /><br />
192 <input type="hidden" name="httpd_location" value="http://example.com/success.html" /><br />
197 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
198 <div class="section">
199 <h2><a name="inline" id="inline">Inline Login</a></h2>
201 <div class="warning"><h3>Warning</h3>
202 <p>A risk exists that under certain circumstances, the login form configured
203 using inline login may be submitted more than once, revealing login credentials to
204 the application running underneath. The administrator must ensure that the underlying
205 application is properly secured to prevent abuse. If in doubt, use the
206 standalone login configuration.</p>
209 <p>As an alternative to having a dedicated login page for a website, it is possible to
210 configure <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> to authenticate users inline, without being
211 redirected to another page. This allows the state of the current page to be preserved
212 during the login attempt. This can be useful in a situation where a time limited
213 session is in force, and the session times out in the middle of the user request. The
214 user can be re-authenticated in place, and they can continue where they left off.</p>
216 <p>If a non-authenticated user attempts to access a page protected by
217 <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> that isn't configured with a
218 <code class="directive"><a href="#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></code> directive,
219 a <var>HTTP_UNAUTHORIZED</var> status code is returned to the browser indicating to the user
220 that they are not authorized to view the page.</p>
222 <p>To configure inline authentication, the administrator overrides the error document
223 returned by the <var>HTTP_UNAUTHORIZED</var> status code with a custom error document
224 containing the login form, as follows:</p>
226 <div class="example"><h3>Basic inline example</h3><p><code>
227 AuthFormProvider file<br />
228 <strong>ErrorDocument 401 /login.shtml</strong><br />
229 AuthUserFile conf/passwd<br />
232 AuthFormLoginRequiredLocation http://example.com/login.html<br />
234 SessionCookieName session path=/<br />
235 SessionCryptoPassphrase secret<br />
238 <p>The error document page should contain a login form with an empty action property,
239 as per the example below. This has the effect of submitting the form to
240 the original protected URL, without the page having to know what that
243 <div class="example"><h3>Example inline login form</h3><p><code>
244 <form method="POST" <strong>action=""</strong>><br />
245 <span class="indent">
246 Username: <input type="text" name="httpd_username" value="" /><br />
247 Password: <input type="password" name="httpd_password" value="" /><br />
248 <input type="submit" name="login" value="Login" /><br />
253 <p>When the end user has filled in their login details, the form will make
254 an HTTP POST request to the original password protected URL.
255 <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> will intercept this POST request, and if
256 HTML fields are found present for the username and password, the user
257 will be logged in, and the original password protected URL will be returned
258 to the user as a GET request.</p>
260 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
261 <div class="section">
262 <h2><a name="inlinepreservebody" id="inlinepreservebody">Inline Login with Body Preservation</a></h2>
264 <p>A limitation of the inline login technique described above is that should an
265 HTML form POST have resulted in the request to authenticate or
267 contents of the original form posted by the browser will be lost. Depending on
268 the function of the website, this could present significant inconvenience for the
271 <p><code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> addresses this by allowing the method and body
272 of the original request to be embedded in the login form. If authentication
273 is successful, the original method and body will be retried by Apache, preserving
274 the state of the original request.</p>
276 <p>To enable body preservation, add three additional fields to the login form as
277 per the example below.</p>
279 <div class="example"><h3>Example with body preservation</h3><p><code>
280 <form method="POST" action=""><br />
281 <span class="indent">
282 Username: <input type="text" name="httpd_username" value="" /><br />
283 Password: <input type="password" name="httpd_password" value="" /><br />
284 <input type="submit" name="login" value="Login" /><br />
285 <strong><input type="hidden" name="httpd_method" value="POST" /><br />
286 <input type="hidden" name="httpd_mimetype" value="application/x-www-form-urlencoded" /><br />
287 <input type="hidden" name="httpd_body" value="name1=value1&name2=value2" /></strong><br />
292 <p>How the method, mimetype and body of the original request are embedded within the
293 login form will depend on the platform and technology being used within the website.
296 <p>One option is to use the <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> module along with the
297 <code class="directive"><a href="../mod/core.html#keptbodysize">KeptBodySize</a></code> directive, along with a suitable
298 CGI script to embed the variables in the form.</p>
300 <p>Another option is to render the login form using a CGI script or other dynamic
303 <div class="example"><h3>CGI example</h3><p><code>
304 AuthFormProvider file<br />
305 <strong>ErrorDocument 401 /cgi-bin/login.cgi</strong><br />
309 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
310 <div class="section">
311 <h2><a name="loggingout" id="loggingout">Logging Out</a></h2>
313 <p>To enable a user to log out of a particular session, configure a page to
314 be handled by the <var>form-logout-handler</var>. Any attempt to access this
315 URL will cause the username and password to be removed from the current
316 session, effectively logging the user out.</p>
319 <code class="directive"><a href="#authformlogoutlocation">AuthFormLogoutLocation</a></code> directive,
320 a URL can be specified that the browser will be redirected to on successful
321 logout. This URL might explain to the user that they have been logged out, and
322 give the user the option to log in again.</p>
324 <div class="example"><h3>Basic logout example</h3><p><code>
325 SetHandler form-logout-handler<br />
327 AuthFormLogoutLocation http://example.com/loggedout.html<br />
329 SessionCookieName session path=/<br />
330 SessionCryptoPassphrase secret<br />
333 <p>Note that logging a user out does not delete the session; it merely removes
334 the username and password from the session. If this results in an empty session,
335 the net effect will be the removal of that session, but this is not
336 guaranteed. If you want to guarantee the removal of a session, set the
337 <code class="directive"><a href="../mod/mod_session.html#sessionmaxage">SessionMaxAge</a></code> directive to a small
338 value, like 1 (setting the directive to zero would mean no session age limit).
341 <div class="example"><h3>Basic session expiry example</h3><p><code>
342 SetHandler form-logout-handler<br />
343 AuthFormLogoutLocation http://example.com/loggedout.html<br />
345 SessionMaxAge 1<br />
346 SessionCookieName session path=/<br />
347 SessionCryptoPassphrase secret<br />
351 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
352 <div class="directive-section"><h2><a name="AuthFormAuthoritative" id="AuthFormAuthoritative">AuthFormAuthoritative</a> <a name="authformauthoritative" id="authformauthoritative">Directive</a></h2>
353 <table class="directive">
354 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets whether authorization and authentication are passed to
355 lower level modules</td></tr>
356 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormAuthoritative On|Off</code></td></tr>
357 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthFormAuthoritative On</code></td></tr>
358 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
359 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
360 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
361 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
363 <p>Normally, each authorization module listed in <code class="directive"><a href="#authformprovider">AuthFormProvider</a></code> will attempt
364 to verify the user, and if the user is not found in any provider,
365 access will be denied. Setting the
366 <code class="directive">AuthFormAuthoritative</code> directive explicitly
367 to <code>Off</code> allows for both authentication and
368 authorization to be passed on to other non-provider-based modules
369 if there is <strong>no userID</strong> or <strong>rule</strong>
370 matching the supplied userID. This should only be necessary when
371 combining <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> with third-party modules
372 that are not configured with the <code class="directive"><a href="#authformprovider">AuthFormProvider</a></code>
373 directive. When using such modules, the order of processing
374 is determined in the modules' source code and is not configurable.</p>
377 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
378 <div class="directive-section"><h2><a name="AuthFormBody" id="AuthFormBody">AuthFormBody</a> <a name="authformbody" id="authformbody">Directive</a></h2>
379 <table class="directive">
380 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The name of a form field carrying the body of the request to attempt on successful login</td></tr>
381 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormBody <var>fieldname</var></code></td></tr>
382 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_body</code></td></tr>
383 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
384 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
385 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
386 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
388 <p>The <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code> directive specifies
389 the name of an HTML field which, if present, will contain the method of the request to
390 to submit should login be successful.</p>
392 <p>By populating the form with fields described by
393 <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code>,
394 <code class="directive"><a href="#authformmimetype">AuthFormMimetype</a></code> and
395 <code class="directive"><a href="#authformbody">AuthFormBody</a></code>, a website can retry
396 a request that may have been interrupted by the login screen, or by a session
400 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
401 <div class="directive-section"><h2><a name="AuthFormDisableNoStore" id="AuthFormDisableNoStore">AuthFormDisableNoStore</a> <a name="authformdisablenostore" id="authformdisablenostore">Directive</a></h2>
402 <table class="directive">
403 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Disable the CacheControl no-store header on the login page</td></tr>
404 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormDisableNoStore <var>On|Off</var></code></td></tr>
405 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthFormDisableNoStore Off</code></td></tr>
406 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
407 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
408 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
409 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
411 <p>The <code class="directive"><a href="#authformdisablenostore">AuthFormDisableNoStore</a></code> flag
412 disables the sending of a <code>Cache-Control no-store</code> header with the
413 error 401 page returned when the user is not yet logged in. The purpose of the header
414 is to make it difficult for an ecmascript application to attempt to resubmit the
415 login form, and reveal the username and password to the backend application. Disable
416 at your own risk.</p>
420 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
421 <div class="directive-section"><h2><a name="AuthFormFakeBasicAuth" id="AuthFormFakeBasicAuth">AuthFormFakeBasicAuth</a> <a name="authformfakebasicauth" id="authformfakebasicauth">Directive</a></h2>
422 <table class="directive">
423 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Fake a Basic Authentication header</td></tr>
424 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormFakeBasicAuth <var>On|Off</var></code></td></tr>
425 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthFormFakeBasicAuth Off</code></td></tr>
426 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
427 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
428 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
429 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
431 <p>The <code class="directive"><a href="#authformfakebasicauth">AuthFormFakeBasicAuth</a></code> flag
432 determines whether a <code>Basic Authentication</code> header will be added to
433 the request headers. This can be used to expose the username and password to
434 an underlying application, without the underlying application having to be aware
435 of how the login was achieved.</p>
439 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
440 <div class="directive-section"><h2><a name="AuthFormLocation" id="AuthFormLocation">AuthFormLocation</a> <a name="authformlocation" id="authformlocation">Directive</a></h2>
441 <table class="directive">
442 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The name of a form field carrying a URL to redirect to on successful login</td></tr>
443 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormLocation <var>fieldname</var></code></td></tr>
444 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_location</code></td></tr>
445 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
446 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
447 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
448 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
450 <p>The <code class="directive"><a href="#authformlocation">AuthFormLocation</a></code> directive specifies
451 the name of an HTML field which, if present, will contain a URL to redirect the browser to
452 should login be successful.</p>
455 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
456 <div class="directive-section"><h2><a name="AuthFormLoginRequiredLocation" id="AuthFormLoginRequiredLocation">AuthFormLoginRequiredLocation</a> <a name="authformloginrequiredlocation" id="authformloginrequiredlocation">Directive</a></h2>
457 <table class="directive">
458 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The URL of the page to be redirected to should login be required</td></tr>
459 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormLoginRequiredLocation <var>url</var></code></td></tr>
460 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
461 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
462 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
463 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
464 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
466 <p>The <code class="directive"><a href="#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></code> directive
467 specifies the URL to redirect to should the user not be authorised to view a page. By default,
468 if a user is not authorised to view a page, the HTTP response code <code>HTTP_UNAUTHORIZED</code>
469 will be returned with the page specified by the
470 <code class="directive"><a href="../mod/core.html#errordocument">ErrorDocument</a></code> directive. This directive overrides this
473 <p>Use this directive if you have a dedicated login page to redirect users to.</p>
477 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
478 <div class="directive-section"><h2><a name="AuthFormLoginSuccessLocation" id="AuthFormLoginSuccessLocation">AuthFormLoginSuccessLocation</a> <a name="authformloginsuccesslocation" id="authformloginsuccesslocation">Directive</a></h2>
479 <table class="directive">
480 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The URL of the page to be redirected to should login be successful</td></tr>
481 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormLoginSuccessLocation <var>url</var></code></td></tr>
482 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
483 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
484 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
485 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
486 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
488 <p>The <code class="directive"><a href="#authformloginsuccesslocation">AuthFormLoginSuccessLocation</a></code> directive
489 specifies the URL to redirect to should the user have logged in successfully. This directive
490 can be overridden if a form field has been defined containing another URL using the
491 <code class="directive"><a href="#authformlocation">AuthFormLocation</a></code> directive.</p>
493 <p>Use this directive if you have a dedicated login URL, and you have not embedded the
494 destination page in the login form.</p>
498 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
499 <div class="directive-section"><h2><a name="AuthFormLogoutLocation" id="AuthFormLogoutLocation">AuthFormLogoutLocation</a> <a name="authformlogoutlocation" id="authformlogoutlocation">Directive</a></h2>
500 <table class="directive">
501 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The URL to redirect to after a user has logged out</td></tr>
502 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormLogoutLocation <var>uri</var></code></td></tr>
503 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
504 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
505 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
506 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
507 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
509 <p>The <code class="directive"><a href="#authformlogoutlocation">AuthFormLogoutLocation</a></code> directive
510 specifies the URL of a page on the server to redirect to should the user attempt to log out.</p>
512 <p>When a URI is accessed that is served by the handler <code>form-logout-handler</code>,
513 the page specified by this directive will be shown to the end user. For example:</p>
515 <div class="example"><h3>Example</h3><p><code>
516 <Location /logout><br />
517 <span class="indent">
518 SetHandler form-logout-handler<br />
519 AuthFormLogoutLocation http://example.com/loggedout.html<br />
526 <p>An attempt to access the URI <var>/logout/</var> will result in the user being logged
527 out, and the page <var>/loggedout.html</var> will be displayed. Make sure that the page
528 <var>loggedout.html</var> is not password protected, otherwise the page will not be
533 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
534 <div class="directive-section"><h2><a name="AuthFormMethod" id="AuthFormMethod">AuthFormMethod</a> <a name="authformmethod" id="authformmethod">Directive</a></h2>
535 <table class="directive">
536 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The name of a form field carrying the method of the request to attempt on successful login</td></tr>
537 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormMethod <var>fieldname</var></code></td></tr>
538 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_method</code></td></tr>
539 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
540 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
541 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
542 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
544 <p>The <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code> directive specifies
545 the name of an HTML field which, if present, will contain the method of the request to
546 to submit should login be successful.</p>
548 <p>By populating the form with fields described by
549 <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code>,
550 <code class="directive"><a href="#authformmimetype">AuthFormMimetype</a></code> and
551 <code class="directive"><a href="#authformbody">AuthFormBody</a></code>, a website can retry
552 a request that may have been interrupted by the login screen, or by a session
556 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
557 <div class="directive-section"><h2><a name="AuthFormMimetype" id="AuthFormMimetype">AuthFormMimetype</a> <a name="authformmimetype" id="authformmimetype">Directive</a></h2>
558 <table class="directive">
559 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The name of a form field carrying the mimetype of the body of the request to attempt on successful login</td></tr>
560 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormMimetype <var>fieldname</var></code></td></tr>
561 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_mimetype</code></td></tr>
562 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
563 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
564 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
565 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
567 <p>The <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code> directive specifies
568 the name of an HTML field which, if present, will contain the
569 mimetype of the request to to submit should login be successful.</p>
571 <p>By populating the form with fields described by
572 <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code>,
573 <code class="directive"><a href="#authformmimetype">AuthFormMimetype</a></code> and
574 <code class="directive"><a href="#authformbody">AuthFormBody</a></code>, a website can retry
575 a request that may have been interrupted by the login screen, or by a session
579 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
580 <div class="directive-section"><h2><a name="AuthFormPassword" id="AuthFormPassword">AuthFormPassword</a> <a name="authformpassword" id="authformpassword">Directive</a></h2>
581 <table class="directive">
582 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The name of a form field carrying the login password</td></tr>
583 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormPassword <var>fieldname</var></code></td></tr>
584 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_password</code></td></tr>
585 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
586 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
587 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
588 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
590 <p>The <code class="directive"><a href="#authformpassword">AuthFormPassword</a></code> directive specifies
591 the name of an HTML field which, if present, will contain the password to be used to log
595 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
596 <div class="directive-section"><h2><a name="AuthFormProvider" id="AuthFormProvider">AuthFormProvider</a> <a name="authformprovider" id="authformprovider">Directive</a></h2>
597 <table class="directive">
598 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the authentication provider(s) for this location</td></tr>
599 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormProvider <var>provider-name</var>
600 [<var>provider-name</var>] ...</code></td></tr>
601 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthFormProvider file</code></td></tr>
602 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
603 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
604 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
605 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
607 <p>The <code class="directive">AuthFormProvider</code> directive sets
608 which provider is used to authenticate the users for this location.
609 The default <code>file</code> provider is implemented
610 by the <code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code> module. Make sure
611 that the chosen provider module is present in the server.</p>
613 <div class="example"><h3>Example</h3><p><code>
614 <Location /secure><br />
615 <span class="indent">
617 AuthName "private area"<br />
618 AuthFormProvider dbm<br />
619 AuthDBMType SDBM<br />
620 AuthDBMUserFile /www/etc/dbmpasswd<br />
621 Require valid-user<br />
627 <p>Providers are implemented by <code class="module"><a href="../mod/mod_authn_dbm.html">mod_authn_dbm</a></code>,
628 <code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code>, <code class="module"><a href="../mod/mod_authn_dbd.html">mod_authn_dbd</a></code>,
629 and <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code>.</p>
632 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
633 <div class="directive-section"><h2><a name="AuthFormSitePassphrase" id="AuthFormSitePassphrase">AuthFormSitePassphrase</a> <a name="authformsitepassphrase" id="authformsitepassphrase">Directive</a></h2>
634 <table class="directive">
635 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Bypass authentication checks for high traffic sites</td></tr>
636 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormSitePassphrase <var>secret</var></code></td></tr>
637 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
638 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
639 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
640 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
641 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
643 <p>The <code class="directive"><a href="#authformsitepassphrase">AuthFormSitePassphrase</a></code> directive
644 specifies a passphrase which, if present in the user session, causes Apache to
645 bypass authentication checks for the given URL. It can be used on high traffic websites
646 to reduce the load induced on authentication infrastructure.</p>
648 <p>The passphrase can be inserted into a user session by adding this directive to the
649 configuration for the <var>form-login-handler</var>. The <var>form-login-handler</var>
650 itself will always run the authentication checks, regardless of whether a passphrase
651 is specified or not.</p>
653 <div class="warning"><h3>Warning</h3>
654 <p>If the session is exposed to the user through the use of
655 <code class="module"><a href="../mod/mod_session_cookie.html">mod_session_cookie</a></code>, and the session is not protected with
656 <code class="module"><a href="../mod/mod_session_crypto.html">mod_session_crypto</a></code>, the passphrase is open to potential exposure
657 through a dictionary attack. Regardless of how the session is configured,
658 ensure that this directive is not used within URL spaces where private user data
659 could be exposed, or sensitive transactions can be conducted. Use at own risk.</p>
664 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
665 <div class="directive-section"><h2><a name="AuthFormSize" id="AuthFormSize">AuthFormSize</a> <a name="authformsize" id="authformsize">Directive</a></h2>
666 <table class="directive">
667 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The largest size of the form in bytes that will be parsed for the login details</td></tr>
668 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormBody <var>size</var></code></td></tr>
669 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>8192</code></td></tr>
670 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
671 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
672 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
673 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
675 <p>The <code class="directive"><a href="#authformsize">AuthFormSize</a></code> directive specifies
676 the maximum size of the body of the request that will be parsed to find the login form.</p>
678 <p>If a login request arrives that exceeds this size, the whole request will be aborted
679 with the HTTP response code <code>HTTP_REQUEST_TOO_LARGE</code>.</p>
681 <p>If you have populated the form with fields described by
682 <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code>,
683 <code class="directive"><a href="#authformmimetype">AuthFormMimetype</a></code> and
684 <code class="directive"><a href="#authformbody">AuthFormBody</a></code>, you probably want to set this
685 field to a similar size as the <code class="directive"><a href="../mod/core.html#keptbodysize">KeptBodySize</a></code>
690 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
691 <div class="directive-section"><h2><a name="AuthFormUsername" id="AuthFormUsername">AuthFormUsername</a> <a name="authformusername" id="authformusername">Directive</a></h2>
692 <table class="directive">
693 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The name of a form field carrying the login username</td></tr>
694 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormUsername <var>fieldname</var></code></td></tr>
695 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_username</code></td></tr>
696 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
697 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
698 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
699 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3.0 and later</td></tr>
701 <p>The <code class="directive"><a href="#authformusername">AuthFormUsername</a></code> directive specifies
702 the name of an HTML field which, if present, will contain the username to be used to log
707 <div class="bottomlang">
708 <p><span>Available Languages: </span><a href="../en/mod/mod_auth_form.html" title="English"> en </a></p>
709 </div><div id="footer">
710 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
711 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>