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" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
12 <script src="../style/scripts/prettify.js" type="text/javascript">
15 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
17 <div id="page-header">
18 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
19 <p class="apache">Apache HTTP Server Version 2.5</p>
20 <img alt="" src="../images/feather.gif" /></div>
21 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
23 <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.5</a> > <a href="./">Modules</a></div>
24 <div id="page-content">
25 <div id="preamble"><h1>Apache Module mod_auth_form</h1>
27 <p><span>Available Languages: </span><a href="../en/mod/mod_auth_form.html" title="English"> en </a></p>
29 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Form authentication</td></tr>
30 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
31 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>auth_form_module</td></tr>
32 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_auth_form.c</td></tr>
33 <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.3 and later</td></tr></table>
36 <div class="warning"><h3>Warning</h3>
37 <p>Form authentication depends on the <code class="module"><a href="../mod/mod_session.html">mod_session</a></code>
38 modules, and these modules make use of HTTP cookies, and as such can fall
39 victim to Cross Site Scripting attacks, or expose potentially private
40 information to clients. Please ensure that the relevant risks have
41 been taken into account before enabling the session functionality on
45 <p>This module allows the use of an HTML login form to restrict access
46 by looking up users in the given providers. HTML forms require
47 significantly more configuration than the alternatives, however an
48 HTML login form can provide a much friendlier experience for end users.
51 <p>HTTP basic authentication is provided by
52 <code class="module"><a href="../mod/mod_auth_basic.html">mod_auth_basic</a></code>, and HTTP digest authentication is
53 provided by <code class="module"><a href="../mod/mod_auth_digest.html">mod_auth_digest</a></code>. This module should
54 be combined with at least one authentication module
55 such as <code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code> and one authorization
56 module such as <code class="module"><a href="../mod/mod_authz_user.html">mod_authz_user</a></code>.</p>
58 <p>Once the user has been successfully authenticated, the user's login
59 details will be stored in a session provided by <code class="module"><a href="../mod/mod_session.html">mod_session</a></code>.
63 <div id="quickview"><h3 class="directives">Directives</h3>
65 <li><img alt="" src="../images/down.gif" /> <a href="#authformauthoritative">AuthFormAuthoritative</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#authformbody">AuthFormBody</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#authformdisablenostore">AuthFormDisableNoStore</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#authformfakebasicauth">AuthFormFakeBasicAuth</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#authformlocation">AuthFormLocation</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#authformloginsuccesslocation">AuthFormLoginSuccessLocation</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#authformlogoutlocation">AuthFormLogoutLocation</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#authformmethod">AuthFormMethod</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#authformmimetype">AuthFormMimetype</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#authformpassword">AuthFormPassword</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#authformprovider">AuthFormProvider</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#authformsitepassphrase">AuthFormSitePassphrase</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#authformsize">AuthFormSize</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#authformusername">AuthFormUsername</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#basicconfig">Basic Configuration</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#standalone">Standalone Login</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#inline">Inline Login</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#inlinepreservebody">Inline Login with Body Preservation</a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#loggingout">Logging Out</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#urlencoding">Usernames and Passwords</a></li>
89 </ul><h3>See also</h3>
91 <li><code class="module"><a href="../mod/mod_session.html">mod_session</a></code></li>
92 <li><code class="directive"><a href="../mod/mod_authn_core.html#authname">AuthName</a></code></li>
93 <li><code class="directive"><a href="../mod/mod_authn_core.html#authtype">AuthType</a></code></li>
94 <li><code class="directive"><a href="../mod/mod_authz_core.html#require">Require</a></code></li>
95 <li><a href="../howto/auth.html">Authentication howto</a></li>
96 </ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
97 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
99 <h2><a name="basicconfig" id="basicconfig">Basic Configuration</a></h2>
101 <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
102 decide where you will store your <var>session</var>, and you will need to
103 decide what method you will use to authenticate. In this simple example, the
104 login details will be stored in a session based on
105 <code class="module"><a href="../mod/mod_session_cookie.html">mod_session_cookie</a></code>, and authentication will be attempted against
106 a file using <code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code>. If authentication is unsuccessful,
107 the user will be redirected to the form login page.</p>
109 <div class="example"><h3>Basic example</h3><pre class="prettyprint lang-config">
110 AuthFormProvider file
111 AuthUserFile conf/passwd
114 AuthFormLoginRequiredLocation http://example.com/login.html
116 SessionCookieName session path=/
117 SessionCryptoPassphrase secret
121 <p>The directive <code class="directive"><a href="../mod/mod_authn_core.html#authtype">AuthType</a></code> will enable
122 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>.
123 The directives <code class="directive"><a href="#authformprovider">AuthFormProvider</a></code> and
124 <code class="directive"><a href="../mod/mod_authn_file.html#authuserfile">AuthUserFile</a></code> specify that usernames
125 and passwords should be checked against the chosen file.</p>
127 <p>The directives <code class="directive"><a href="../mod/mod_session.html#session">Session</a></code>,
128 <code class="directive"><a href="../mod/mod_session_cookie.html#sessioncookiename">SessionCookieName</a></code> and
129 <code class="directive"><a href="../mod/mod_session_crypto.html#sessioncryptopassphrase">SessionCryptoPassphrase</a></code> create an
130 encrypted session stored within an HTTP cookie on the browser. For more information
131 on the different options for configuring a session, read the documentation for
132 <code class="module"><a href="../mod/mod_session.html">mod_session</a></code>.</p>
134 <p>In the simple example above, a URL has been protected by
135 <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
136 enter their username and password. Options for doing so include providing a
137 dedicated standalone login page for this purpose, or for providing the login
139 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
140 <div class="section">
141 <h2><a name="standalone" id="standalone">Standalone Login</a></h2>
143 <p>The login form can be hosted as a standalone page, or can be provided inline on
146 <p>When configuring the login as a standalone page, unsuccessful authentication
147 attempts should be redirected to a login form created by the website for this purpose,
148 using the <code class="directive"><a href="#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></code>
149 directive. Typically this login page will contain an HTML form, asking the user to
150 provide their usename and password.</p>
152 <div class="example"><h3>Example login form</h3><p><code>
153 <form method="POST" action="/dologin.html"><br />
154 Username: <input type="text" name="httpd_username" value="" /><br />
155 Password: <input type="password" name="httpd_password" value="" /><br />
156 <input type="submit" name="login" value="Login" /><br />
160 <p>The part that does the actual login is handled by the <var>form-login-handler</var>.
161 The action of the form should point at this handler, which is configured within
162 Apache httpd as follows:</p>
164 <div class="example"><h3>Form login handler example</h3><pre class="prettyprint lang-config">
165 <Location /dologin.html>
166 SetHandler form-login-handler
167 AuthFormLoginRequiredLocation http://example.com/login.html
168 AuthFormLoginSuccessLocation http://example.com/success.html
169 AuthFormProvider file
170 AuthUserFile conf/passwd
174 SessionCookieName session path=/
175 SessionCryptoPassphrase secret
180 <p>The URLs specified by the
181 <code class="directive"><a href="#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></code> directive will typically
182 point to a page explaining to the user that their login attempt was unsuccessful, and they
183 should try again. The <code class="directive"><a href="#authformloginsuccesslocation">AuthFormLoginSuccessLocation</a></code>
184 directive specifies the URL the user should be redirected to upon successful login.</p>
186 <p>Alternatively, the URL to redirect the user to on success can be embedded within the login
187 form, as in the example below. As a result, the same <var>form-login-handler</var> can be
188 reused for different areas of a website.</p>
190 <div class="example"><h3>Example login form with location</h3><p><code>
191 <form method="POST" action="/dologin.html"><br />
192 <span class="indent">
193 Username: <input type="text" name="httpd_username" value="" /><br />
194 Password: <input type="password" name="httpd_password" value="" /><br />
195 <input type="submit" name="login" value="Login" /><br />
196 <input type="hidden" name="httpd_location" value="http://example.com/success.html" /><br />
201 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
202 <div class="section">
203 <h2><a name="inline" id="inline">Inline Login</a></h2>
205 <div class="warning"><h3>Warning</h3>
206 <p>A risk exists that under certain circumstances, the login form configured
207 using inline login may be submitted more than once, revealing login credentials to
208 the application running underneath. The administrator must ensure that the underlying
209 application is properly secured to prevent abuse. If in doubt, use the
210 standalone login configuration.</p>
213 <p>As an alternative to having a dedicated login page for a website, it is possible to
214 configure <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> to authenticate users inline, without being
215 redirected to another page. This allows the state of the current page to be preserved
216 during the login attempt. This can be useful in a situation where a time limited
217 session is in force, and the session times out in the middle of the user request. The
218 user can be re-authenticated in place, and they can continue where they left off.</p>
220 <p>If a non-authenticated user attempts to access a page protected by
221 <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> that isn't configured with a
222 <code class="directive"><a href="#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></code> directive,
223 a <var>HTTP_UNAUTHORIZED</var> status code is returned to the browser indicating to the user
224 that they are not authorized to view the page.</p>
226 <p>To configure inline authentication, the administrator overrides the error document
227 returned by the <var>HTTP_UNAUTHORIZED</var> status code with a custom error document
228 containing the login form, as follows:</p>
230 <div class="example"><h3>Basic inline example</h3><pre class="prettyprint lang-config">
231 AuthFormProvider file
232 ErrorDocument 401 /login.shtml
233 AuthUserFile conf/passwd
236 AuthFormLoginRequiredLocation http://example.com/login.html
238 SessionCookieName session path=/
239 SessionCryptoPassphrase secret
243 <p>The error document page should contain a login form with an empty action property,
244 as per the example below. This has the effect of submitting the form to
245 the original protected URL, without the page having to know what that
248 <div class="example"><h3>Example inline login form</h3><p><code>
249 <form method="POST" <strong>action=""</strong>><br />
250 <span class="indent">
251 Username: <input type="text" name="httpd_username" value="" /><br />
252 Password: <input type="password" name="httpd_password" value="" /><br />
253 <input type="submit" name="login" value="Login" /><br />
258 <p>When the end user has filled in their login details, the form will make
259 an HTTP POST request to the original password protected URL.
260 <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> will intercept this POST request, and if
261 HTML fields are found present for the username and password, the user
262 will be logged in, and the original password protected URL will be returned
263 to the user as a GET request.</p>
265 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
266 <div class="section">
267 <h2><a name="inlinepreservebody" id="inlinepreservebody">Inline Login with Body Preservation</a></h2>
269 <p>A limitation of the inline login technique described above is that should an
270 HTML form POST have resulted in the request to authenticate or
272 contents of the original form posted by the browser will be lost. Depending on
273 the function of the website, this could present significant inconvenience for the
276 <p><code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> addresses this by allowing the method and body
277 of the original request to be embedded in the login form. If authentication
278 is successful, the original method and body will be retried by Apache httpd, preserving
279 the state of the original request.</p>
281 <p>To enable body preservation, add three additional fields to the login form as
282 per the example below.</p>
284 <div class="example"><h3>Example with body preservation</h3><p><code>
285 <form method="POST" action=""><br />
286 <span class="indent">
287 Username: <input type="text" name="httpd_username" value="" /><br />
288 Password: <input type="password" name="httpd_password" value="" /><br />
289 <input type="submit" name="login" value="Login" /><br />
290 <strong><input type="hidden" name="httpd_method" value="POST" /><br />
291 <input type="hidden" name="httpd_mimetype" value="application/x-www-form-urlencoded" /><br />
292 <input type="hidden" name="httpd_body" value="name1=value1&name2=value2" /></strong><br />
297 <p>How the method, mimetype and body of the original request are embedded within the
298 login form will depend on the platform and technology being used within the website.
301 <p>One option is to use the <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> module along with the
302 <code class="directive"><a href="../mod/mod_request.html#keptbodysize">KeptBodySize</a></code> directive, along with a suitable
303 CGI script to embed the variables in the form.</p>
305 <p>Another option is to render the login form using a CGI script or other dynamic
308 <div class="example"><h3>CGI example</h3><pre class="prettyprint lang-config">
309 AuthFormProvider file
310 <strong>ErrorDocument 401 /cgi-bin/login.cgi</strong>
315 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
316 <div class="section">
317 <h2><a name="loggingout" id="loggingout">Logging Out</a></h2>
319 <p>To enable a user to log out of a particular session, configure a page to
320 be handled by the <var>form-logout-handler</var>. Any attempt to access this
321 URL will cause the username and password to be removed from the current
322 session, effectively logging the user out.</p>
325 <code class="directive"><a href="#authformlogoutlocation">AuthFormLogoutLocation</a></code> directive,
326 a URL can be specified that the browser will be redirected to on successful
327 logout. This URL might explain to the user that they have been logged out, and
328 give the user the option to log in again.</p>
330 <div class="example"><h3>Basic logout example</h3><pre class="prettyprint lang-config">
331 SetHandler form-logout-handler
333 AuthFormLogoutLocation http://example.com/loggedout.html
335 SessionCookieName session path=/
336 SessionCryptoPassphrase secret
340 <p>Note that logging a user out does not delete the session; it merely removes
341 the username and password from the session. If this results in an empty session,
342 the net effect will be the removal of that session, but this is not
343 guaranteed. If you want to guarantee the removal of a session, set the
344 <code class="directive"><a href="../mod/mod_session.html#sessionmaxage">SessionMaxAge</a></code> directive to a small
345 value, like 1 (setting the directive to zero would mean no session age limit).
348 <div class="example"><h3>Basic session expiry example</h3><pre class="prettyprint lang-config">
349 SetHandler form-logout-handler
350 AuthFormLogoutLocation http://example.com/loggedout.html
353 SessionCookieName session path=/
354 SessionCryptoPassphrase secret
358 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
359 <div class="section">
360 <h2><a name="urlencoding" id="urlencoding">Usernames and Passwords</a></h2>
361 <p>Note that form submission involves URLEncoding the form data:
362 in this case the username and password. You should therefore
363 pick usernames and passwords that avoid characters that are
364 URLencoded in form submission, or you may get unexpected results.</p>
366 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
367 <div class="directive-section"><h2><a name="AuthFormAuthoritative" id="AuthFormAuthoritative">AuthFormAuthoritative</a> <a name="authformauthoritative" id="authformauthoritative">Directive</a></h2>
368 <table class="directive">
369 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets whether authorization and authentication are passed to
370 lower level modules</td></tr>
371 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormAuthoritative On|Off</code></td></tr>
372 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthFormAuthoritative On</code></td></tr>
373 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
374 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
375 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
376 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
378 <p>Normally, each authorization module listed in <code class="directive"><a href="#authformprovider">AuthFormProvider</a></code> will attempt
379 to verify the user, and if the user is not found in any provider,
380 access will be denied. Setting the
381 <code class="directive">AuthFormAuthoritative</code> directive explicitly
382 to <code>Off</code> allows for both authentication and
383 authorization to be passed on to other non-provider-based modules
384 if there is <strong>no userID</strong> or <strong>rule</strong>
385 matching the supplied userID. This should only be necessary when
386 combining <code class="module"><a href="../mod/mod_auth_form.html">mod_auth_form</a></code> with third-party modules
387 that are not configured with the <code class="directive"><a href="#authformprovider">AuthFormProvider</a></code>
388 directive. When using such modules, the order of processing
389 is determined in the modules' source code and is not configurable.</p>
392 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
393 <div class="directive-section"><h2><a name="AuthFormBody" id="AuthFormBody">AuthFormBody</a> <a name="authformbody" id="authformbody">Directive</a></h2>
394 <table class="directive">
395 <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>
396 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormBody <var>fieldname</var></code></td></tr>
397 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_body</code></td></tr>
398 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
399 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
400 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
401 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
403 <p>The <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code> directive specifies
404 the name of an HTML field which, if present, will contain the method of the request to
405 to submit should login be successful.</p>
407 <p>By populating the form with fields described by
408 <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code>,
409 <code class="directive"><a href="#authformmimetype">AuthFormMimetype</a></code> and
410 <code class="directive"><a href="#authformbody">AuthFormBody</a></code>, a website can retry
411 a request that may have been interrupted by the login screen, or by a session
415 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
416 <div class="directive-section"><h2><a name="AuthFormDisableNoStore" id="AuthFormDisableNoStore">AuthFormDisableNoStore</a> <a name="authformdisablenostore" id="authformdisablenostore">Directive</a></h2>
417 <table class="directive">
418 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Disable the CacheControl no-store header on the login page</td></tr>
419 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormDisableNoStore <var>On|Off</var></code></td></tr>
420 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthFormDisableNoStore Off</code></td></tr>
421 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
422 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
423 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
424 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
426 <p>The <code class="directive"><a href="#authformdisablenostore">AuthFormDisableNoStore</a></code> flag
427 disables the sending of a <code>Cache-Control no-store</code> header with the
428 error 401 page returned when the user is not yet logged in. The purpose of the header
429 is to make it difficult for an ecmascript application to attempt to resubmit the
430 login form, and reveal the username and password to the backend application. Disable
431 at your own risk.</p>
435 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
436 <div class="directive-section"><h2><a name="AuthFormFakeBasicAuth" id="AuthFormFakeBasicAuth">AuthFormFakeBasicAuth</a> <a name="authformfakebasicauth" id="authformfakebasicauth">Directive</a></h2>
437 <table class="directive">
438 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Fake a Basic Authentication header</td></tr>
439 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormFakeBasicAuth <var>On|Off</var></code></td></tr>
440 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthFormFakeBasicAuth Off</code></td></tr>
441 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
442 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
443 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
444 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
446 <p>The <code class="directive"><a href="#authformfakebasicauth">AuthFormFakeBasicAuth</a></code> flag
447 determines whether a <code>Basic Authentication</code> header will be added to
448 the request headers. This can be used to expose the username and password to
449 an underlying application, without the underlying application having to be aware
450 of how the login was achieved.</p>
454 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
455 <div class="directive-section"><h2><a name="AuthFormLocation" id="AuthFormLocation">AuthFormLocation</a> <a name="authformlocation" id="authformlocation">Directive</a></h2>
456 <table class="directive">
457 <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>
458 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormLocation <var>fieldname</var></code></td></tr>
459 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_location</code></td></tr>
460 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
461 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
462 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
463 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
465 <p>The <code class="directive"><a href="#authformlocation">AuthFormLocation</a></code> directive specifies
466 the name of an HTML field which, if present, will contain a URL to redirect the browser to
467 should login be successful.</p>
470 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
471 <div class="directive-section"><h2><a name="AuthFormLoginRequiredLocation" id="AuthFormLoginRequiredLocation">AuthFormLoginRequiredLocation</a> <a name="authformloginrequiredlocation" id="authformloginrequiredlocation">Directive</a></h2>
472 <table class="directive">
473 <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>
474 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormLoginRequiredLocation <var>url</var></code></td></tr>
475 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
476 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
477 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
478 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
479 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
481 <p>The <code class="directive"><a href="#authformloginrequiredlocation">AuthFormLoginRequiredLocation</a></code> directive
482 specifies the URL to redirect to should the user not be authorised to view a page. By default,
483 if a user is not authorised to view a page, the HTTP response code <code>HTTP_UNAUTHORIZED</code>
484 will be returned with the page specified by the
485 <code class="directive"><a href="../mod/core.html#errordocument">ErrorDocument</a></code> directive. This directive overrides this
488 <p>Use this directive if you have a dedicated login page to redirect users to.</p>
492 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
493 <div class="directive-section"><h2><a name="AuthFormLoginSuccessLocation" id="AuthFormLoginSuccessLocation">AuthFormLoginSuccessLocation</a> <a name="authformloginsuccesslocation" id="authformloginsuccesslocation">Directive</a></h2>
494 <table class="directive">
495 <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>
496 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormLoginSuccessLocation <var>url</var></code></td></tr>
497 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
498 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
499 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
500 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
501 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
503 <p>The <code class="directive"><a href="#authformloginsuccesslocation">AuthFormLoginSuccessLocation</a></code> directive
504 specifies the URL to redirect to should the user have logged in successfully. This directive
505 can be overridden if a form field has been defined containing another URL using the
506 <code class="directive"><a href="#authformlocation">AuthFormLocation</a></code> directive.</p>
508 <p>Use this directive if you have a dedicated login URL, and you have not embedded the
509 destination page in the login form.</p>
513 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
514 <div class="directive-section"><h2><a name="AuthFormLogoutLocation" id="AuthFormLogoutLocation">AuthFormLogoutLocation</a> <a name="authformlogoutlocation" id="authformlogoutlocation">Directive</a></h2>
515 <table class="directive">
516 <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>
517 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormLogoutLocation <var>uri</var></code></td></tr>
518 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
519 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
520 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
521 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
522 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
524 <p>The <code class="directive"><a href="#authformlogoutlocation">AuthFormLogoutLocation</a></code> directive
525 specifies the URL of a page on the server to redirect to should the user attempt to log out.</p>
527 <p>When a URI is accessed that is served by the handler <code>form-logout-handler</code>,
528 the page specified by this directive will be shown to the end user. For example:</p>
530 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
531 <Location /logout>
532 SetHandler form-logout-handler
533 AuthFormLogoutLocation http://example.com/loggedout.html
540 <p>An attempt to access the URI <var>/logout/</var> will result in the user being logged
541 out, and the page <var>/loggedout.html</var> will be displayed. Make sure that the page
542 <var>loggedout.html</var> is not password protected, otherwise the page will not be
547 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
548 <div class="directive-section"><h2><a name="AuthFormMethod" id="AuthFormMethod">AuthFormMethod</a> <a name="authformmethod" id="authformmethod">Directive</a></h2>
549 <table class="directive">
550 <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>
551 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormMethod <var>fieldname</var></code></td></tr>
552 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_method</code></td></tr>
553 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
554 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
555 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
556 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
558 <p>The <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code> directive specifies
559 the name of an HTML field which, if present, will contain the method of the request to
560 to submit should login be successful.</p>
562 <p>By populating the form with fields described by
563 <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code>,
564 <code class="directive"><a href="#authformmimetype">AuthFormMimetype</a></code> and
565 <code class="directive"><a href="#authformbody">AuthFormBody</a></code>, a website can retry
566 a request that may have been interrupted by the login screen, or by a session
570 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
571 <div class="directive-section"><h2><a name="AuthFormMimetype" id="AuthFormMimetype">AuthFormMimetype</a> <a name="authformmimetype" id="authformmimetype">Directive</a></h2>
572 <table class="directive">
573 <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>
574 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormMimetype <var>fieldname</var></code></td></tr>
575 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_mimetype</code></td></tr>
576 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
577 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
578 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
579 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
581 <p>The <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code> directive specifies
582 the name of an HTML field which, if present, will contain the
583 mimetype of the request to to submit should login be successful.</p>
585 <p>By populating the form with fields described by
586 <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code>,
587 <code class="directive"><a href="#authformmimetype">AuthFormMimetype</a></code> and
588 <code class="directive"><a href="#authformbody">AuthFormBody</a></code>, a website can retry
589 a request that may have been interrupted by the login screen, or by a session
593 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
594 <div class="directive-section"><h2><a name="AuthFormPassword" id="AuthFormPassword">AuthFormPassword</a> <a name="authformpassword" id="authformpassword">Directive</a></h2>
595 <table class="directive">
596 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The name of a form field carrying the login password</td></tr>
597 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormPassword <var>fieldname</var></code></td></tr>
598 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_password</code></td></tr>
599 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
600 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
601 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
602 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
604 <p>The <code class="directive"><a href="#authformpassword">AuthFormPassword</a></code> directive specifies
605 the name of an HTML field which, if present, will contain the password to be used to log
609 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
610 <div class="directive-section"><h2><a name="AuthFormProvider" id="AuthFormProvider">AuthFormProvider</a> <a name="authformprovider" id="authformprovider">Directive</a></h2>
611 <table class="directive">
612 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the authentication provider(s) for this location</td></tr>
613 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormProvider <var>provider-name</var>
614 [<var>provider-name</var>] ...</code></td></tr>
615 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthFormProvider file</code></td></tr>
616 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
617 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>AuthConfig</td></tr>
618 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
619 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
621 <p>The <code class="directive">AuthFormProvider</code> directive sets
622 which provider is used to authenticate the users for this location.
623 The default <code>file</code> provider is implemented
624 by the <code class="module"><a href="../mod/mod_authn_file.html">mod_authn_file</a></code> module. Make sure
625 that the chosen provider module is present in the server.</p>
627 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
628 <Location /secure>
630 AuthName "private area"
633 AuthDBMUserFile /www/etc/dbmpasswd
640 <p>Providers are implemented by <code class="module"><a href="../mod/mod_authn_dbm.html">mod_authn_dbm</a></code>,
641 <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>,
642 <code class="module"><a href="../mod/mod_authnz_ldap.html">mod_authnz_ldap</a></code> and <code class="module"><a href="../mod/mod_authn_socache.html">mod_authn_socache</a></code>.</p>
645 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
646 <div class="directive-section"><h2><a name="AuthFormSitePassphrase" id="AuthFormSitePassphrase">AuthFormSitePassphrase</a> <a name="authformsitepassphrase" id="authformsitepassphrase">Directive</a></h2>
647 <table class="directive">
648 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Bypass authentication checks for high traffic sites</td></tr>
649 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormSitePassphrase <var>secret</var></code></td></tr>
650 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
651 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
652 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
653 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
654 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
656 <p>The <code class="directive"><a href="#authformsitepassphrase">AuthFormSitePassphrase</a></code> directive
657 specifies a passphrase which, if present in the user session, causes Apache httpd to
658 bypass authentication checks for the given URL. It can be used on high traffic websites
659 to reduce the load induced on authentication infrastructure.</p>
661 <p>The passphrase can be inserted into a user session by adding this directive to the
662 configuration for the <var>form-login-handler</var>. The <var>form-login-handler</var>
663 itself will always run the authentication checks, regardless of whether a passphrase
664 is specified or not.</p>
666 <div class="warning"><h3>Warning</h3>
667 <p>If the session is exposed to the user through the use of
668 <code class="module"><a href="../mod/mod_session_cookie.html">mod_session_cookie</a></code>, and the session is not protected with
669 <code class="module"><a href="../mod/mod_session_crypto.html">mod_session_crypto</a></code>, the passphrase is open to potential exposure
670 through a dictionary attack. Regardless of how the session is configured,
671 ensure that this directive is not used within URL spaces where private user data
672 could be exposed, or sensitive transactions can be conducted. Use at own risk.</p>
677 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
678 <div class="directive-section"><h2><a name="AuthFormSize" id="AuthFormSize">AuthFormSize</a> <a name="authformsize" id="authformsize">Directive</a></h2>
679 <table class="directive">
680 <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>
681 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormBody <var>size</var></code></td></tr>
682 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>8192</code></td></tr>
683 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
684 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
685 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
686 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
688 <p>The <code class="directive"><a href="#authformsize">AuthFormSize</a></code> directive specifies
689 the maximum size of the body of the request that will be parsed to find the login form.</p>
691 <p>If a login request arrives that exceeds this size, the whole request will be aborted
692 with the HTTP response code <code>HTTP_REQUEST_TOO_LARGE</code>.</p>
694 <p>If you have populated the form with fields described by
695 <code class="directive"><a href="#authformmethod">AuthFormMethod</a></code>,
696 <code class="directive"><a href="#authformmimetype">AuthFormMimetype</a></code> and
697 <code class="directive"><a href="#authformbody">AuthFormBody</a></code>, you probably want to set this
698 field to a similar size as the <code class="directive"><a href="../mod/mod_request.html#keptbodysize">KeptBodySize</a></code>
703 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
704 <div class="directive-section"><h2><a name="AuthFormUsername" id="AuthFormUsername">AuthFormUsername</a> <a name="authformusername" id="authformusername">Directive</a></h2>
705 <table class="directive">
706 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The name of a form field carrying the login username</td></tr>
707 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthFormUsername <var>fieldname</var></code></td></tr>
708 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>httpd_username</code></td></tr>
709 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
710 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
711 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_auth_form</td></tr>
712 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.3.0 and later</td></tr>
714 <p>The <code class="directive"><a href="#authformusername">AuthFormUsername</a></code> directive specifies
715 the name of an HTML field which, if present, will contain the username to be used to log
720 <div class="bottomlang">
721 <p><span>Available Languages: </span><a href="../en/mod/mod_auth_form.html" title="English"> en </a></p>
722 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>This section is experimental!</strong><br />Comments placed here should not be expected
723 to last beyond the testing phase of this system, nor do we in any way guarantee that we'll read them.</div>
724 <script type="text/javascript"><!--//--><![CDATA[//><!--
726 var disqus_shortname = 'httpd';
727 var disqus_identifier = window.location.href.replace(/(current|trunk)/, "2.4").replace(/\/[a-z]{2}\//, "/").replace(window.location.protocol, "http:") + '.' + lang;
728 if (disqus_identifier.indexOf("httpd.apache.org") == -1) {
729 document.write('<div id="disqus_thread">\n</div>');
731 var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
732 dsq.src = window.location.protocol + '//' + disqus_shortname + '.disqus.com/embed.js';
733 (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
736 document.write("Comments have been disabled for offline viewing.");
738 //--><!]]></script></div><div id="footer">
739 <p class="apache">Copyright 2012 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>
740 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
741 if (typeof(prettyPrint) !== undefined) {