mod_authz_dbd.html.en revision 6fe26506780e73be2a412d758af77fafdf03291a
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>mod_authz_dbd - Apache HTTP Server</title>
<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<body>
<div id="page-header">
<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>
<p class="apache">Apache HTTP Server Version 2.3</p>
<div id="path">
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
<div id="page-content">
<div id="preamble"><h1>Apache Module mod_authz_dbd</h1>
<div class="toplang">
<p><span>Available Languages: </span><a href="/en/mod/mod_authz_dbd.html" title="English"> en </a></p>
</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Group Authorization and Login using SQL</td></tr>
<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>authz_dbd_module</td></tr>
<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.2 and later</td></tr></table>
<h3>Summary</h3>
<p>This module provides authorization capabilities so that
authenticated users can be allowed or denied access to portions
of the web site by group membership. It also provides
</div>
<div id="quickview"><h3 class="directives">Directives</h3>
<ul id="toc">
<li><img alt="" src="/images/down.gif" /> <a href="#authzdbdauthoritative">AuthzDBDAuthoritative</a></li>
<li><img alt="" src="/images/down.gif" /> <a href="#authzdbdlogintoreferer">AuthzDBDLoginToReferer</a></li>
<li><img alt="" src="/images/down.gif" /> <a href="#authzdbdredirectquery">AuthzDBDRedirectQuery</a></li>
</ul>
<h3>Topics</h3>
<ul id="topics">
</ul><h3>See also</h3>
<ul class="seealso">
</ul></div>
<div class="section">
<h2><a name="login" id="login">Database Login</a></h2>
<p>In addition to the standard authz function of checking group
the database, and control the status via designated URLs (subject
of course to users supplying the necessary credentials).</p>
<p>This works by defining two special
<code>Require dbd-login</code> and <code>Require dbd-logout</code>.
For usage details, see the configuration example below.</p>
<div class="section">
<h2><a name="client" id="client">Client Login</a></h2>
or other such token. Although this is not the business of an authz
module, client session management software should be able to tie its
<code class="module"><a href="/mod/mod_authz_dbd.html">mod_authz_dbd</a></code> exports an optional hook that will
be run whenever a user successfully logs into or out of the database.
Session management modules can use the hook to implement functions
to start and end a client session.</p>
<div class="section">
<h2><a name="example" id="example">Configuration Example</a></h2>
<div class="example"><pre><code>
# DBD Configuration
DBDriver oracle
DBDParams "dbname=apacheauth user=apache pass=xxxxxx"
DBDMin 4
DBDKeep 8
DBDMax 20
DBDExptime 300
# authn with mod_authn_dbd
AuthType Basic
AuthName Team
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT pass FROM authn WHERE user = %s AND login = true"
# Require dbd-group and authz_dbd implementation
Require dbd-group team
AuthzDBDQuery "SELECT group FROM authz WHERE user = %s"
ErrorDocument 401 /team-private/login-form.html
<Files login.html>
# Don't require that we're already logged in!
AuthDBDUserPWQuery "SELECT pass FROM authn WHERE user = %s"
# dbd-login action executes a query to set our own state
Require dbd-login
AuthzDBDQuery "UPDATE authn SET login = true WHERE user = %s"
# Return user to referring page (if any) on successful login
AuthzDBDLoginToReferer On
</Files>
<Files logout.html>
# dbd-logout action executes a query to set our own state
Require dbd-logout
AuthzDBDQuery "UPDATE authn SET login = false WHERE user = %s"
</Files>
</Directory>
</code></pre></div>
</div>
<div class="directive-section"><h2><a name="AuthzDBDAuthoritative" id="AuthzDBDAuthoritative">AuthzDBDAuthoritative</a> <a name="authzdbdauthoritative" id="authzdbdauthoritative">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets whether authorization will be passed on to lower level
modules</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthzDBDAuthoritative On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthzDBDAuthoritative On</code></td></tr>
</table>
<p>Setting the <code class="directive">AuthzDBDAuthoritative</code>
directive explicitly to <code>Off</code> allows group authorization
to be handled by another authz module if the userID is not
in any authorized dbd-group. If there are any groups
specified, the usual checks will be applied and a failure will
give an Authentication Required reply.</p>
<p>So if a userID appears in the database of more than one module;
directive applies to more than one module; then the first module
will verify the credentials; and no access is passed on;
regardless of the <code class="directive">AuthAuthoritative</code> setting.</p>
<p>A common use for this is in conjunction with one of the
auth providers; such or
<code class="module"><a href="/mod/mod_authn_file.html">mod_authn_file</a></code>. Whereas this DBD module supplies
the bulk of the user credential checking; a few (administrator) related
accesses fall through to a lower level with a well protected
<code>.htpasswd</code> file.</p>
<p>By default, control is not passed on and an unknown group
will result in an Authentication Required reply. Not
setting it thus keeps the system secure and forces an NCSA
compliant behaviour.</p>
</div>
<div class="directive-section"><h2><a name="AuthzDBDLoginToReferer" id="AuthzDBDLoginToReferer">AuthzDBDLoginToReferer</a> <a name="authzdbdlogintoreferer" id="authzdbdlogintoreferer">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether to redirect the Client to the Referring
page on successful login or logout if a <code>Referer</code> request
header is present</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthzDBDLoginToReferer On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AuthzDBDLoginToReferer Off</code></td></tr>
</table>
<p>In conjunction with <code>Require dbd-login</code> or
<code>Require dbd-logout</code>, this provides the option to
redirect the client back to the Referring page (the URL in
the <code>Referer</code> HTTP request header, if present.
When there is no <code>Referer</code> header,
<code>AuthzDBDLoginToReferer On</code> will be ignored.</p>
</div>
<div class="directive-section"><h2><a name="AuthzDBDQuery" id="AuthzDBDQuery">AuthzDBDQuery</a> <a name="authzdbdquery" id="authzdbdquery">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify the SQL Query for the required operation</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthzDBDQuery SQL-Query</code></td></tr>
</table>
<p>The <code class="directive">AuthzDBDQuery</code> specifies an SQL
query to run. The purpose of the query depends on the
effect.</p>
<ul>
<li>With <code>Require dbd-group</code>, it specifies a query
to look up groups for the current user. This is the standard
functionality of other authz modules such as
<code class="module"><a href="/mod/mod_authz_file.html">mod_authz_file</a></code> and <code class="module"><a href="/mod/mod_authz_dbm.html">mod_authz_dbm</a></code>.
In this case it will typically take the form<br />
<code>AuthzDBDQuery "SELECT group FROM groups WHERE user= %s"</code>
</li>
<li>With <code>Require dbd-login</code> or <code>Require dbd-logout</code>,
it will never deny access, but will instead execute an SQL Query
designed to log the user (who must already be authenticated with
<code class="module"><a href="/mod/mod_authn_dbd.html">mod_authn_dbd</a></code>) in or out. Such a query will
typically take the form<br />
<code>AuthzDBDQuery "UPDATE authn SET login = true WHERE user = %s"</code>
</li>
</ul>
</div>
<div class="directive-section"><h2><a name="AuthzDBDRedirectQuery" id="AuthzDBDRedirectQuery">AuthzDBDRedirectQuery</a> <a name="authzdbdredirectquery" id="authzdbdredirectquery">Directive</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify a query to look up a login page for the user</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AuthzDBDRedirectQuery SQL-Query</code></td></tr>
</table>
<p>Specifies an optional query to use after successful login
(or logout) to redirect the user to a page, which may be
specific to the user. Such a query will take the form<br />
<code>AuthzDBDRedirectQuery "SELECT userpage FROM userpages WHERE user = %s"</code>
</p>
<p>Note that <code class="directive">AuthzDBDLoginToReferer</code> takes
precedence if both are set.</p>
</div>
</div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="/en/mod/mod_authz_dbd.html" title="English"> en </a></p>
</div><div id="footer">
<p class="apache">Copyright 1995-2005 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<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>
</body></html>