summaryrefslogtreecommitdiff
path: root/docs/manual/howto/auth.html.en
diff options
context:
space:
mode:
Diffstat (limited to 'docs/manual/howto/auth.html.en')
-rw-r--r--docs/manual/howto/auth.html.en216
1 files changed, 114 insertions, 102 deletions
diff --git a/docs/manual/howto/auth.html.en b/docs/manual/howto/auth.html.en
index 6ec076f1..32660de0 100644
--- a/docs/manual/howto/auth.html.en
+++ b/docs/manual/howto/auth.html.en
@@ -5,18 +5,21 @@
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
-<title>Authentication, Authorization and Access Control - Apache HTTP Server</title>
+<title>Authentication and Authorization - 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" />
-<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
+<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" />
+<script src="../style/scripts/prettify.js" type="text/javascript">
+</script>
+
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
<body id="manual-page"><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="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>
<p class="apache">Apache HTTP Server Version 2.4</p>
<img alt="" src="../images/feather.gif" /></div>
<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
<div id="path">
-<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.4</a> &gt; <a href="./">How-To / Tutorials</a></div><div id="page-content"><div id="preamble"><h1>Authentication, Authorization and Access Control</h1>
+<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.4</a> &gt; <a href="./">How-To / Tutorials</a></div><div id="page-content"><div id="preamble"><h1>Authentication and Authorization</h1>
<div class="toplang">
<p><span>Available Languages: </span><a href="../en/howto/auth.html" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/howto/auth.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
@@ -45,7 +48,7 @@ person in</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#beyond">Beyond just authorization</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#socache">Authentication Cacheing</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#moreinformation">More information</a></li>
-</ul></div>
+</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="related" id="related">Related Modules and Directives</a></h2>
@@ -139,9 +142,8 @@ module from each group.</p>
an <code class="directive"><a href="../mod/core.html#allowoverride">AllowOverride</a></code> directive like the
following:</p>
- <div class="example"><p><code>
- AllowOverride AuthConfig
- </code></p></div>
+ <pre class="prettyprint lang-config">AllowOverride AuthConfig</pre>
+
<p>Or, if you are just going to put the directives directly in
your main server configuration file, you will of course need to
@@ -213,14 +215,15 @@ module from each group.</p>
placed in <code>httpd.conf</code> inside a &lt;Directory
/usr/local/apache/htdocs/secret&gt; section.</p>
- <div class="example"><p><code>
- AuthType Basic<br />
- AuthName "Restricted Files"<br />
- # (Following line optional)<br />
- AuthBasicProvider file<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- Require user rbowen
- </code></p></div>
+ <pre class="prettyprint lang-config">
+AuthType Basic
+AuthName "Restricted Files"
+# (Following line optional)
+AuthBasicProvider file
+AuthUserFile /usr/local/apache/passwd/passwords
+Require user rbowen
+ </pre>
+
<p>Let's examine each of those directives individually. The <code class="directive"><a href="../mod/mod_authn_core.html#authtype">AuthType</a></code> directive selects
that method that is used to authenticate the user. The most
@@ -310,15 +313,16 @@ person in</a></h2>
<p>Now, you need to modify your <code>.htaccess</code> file to
look like the following:</p>
- <div class="example"><p><code>
- AuthType Basic<br />
- AuthName "By Invitation Only"<br />
- # Optional line:<br />
- AuthBasicProvider file<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- AuthGroupFile /usr/local/apache/passwd/groups<br />
- Require group GroupName
- </code></p></div>
+ <pre class="prettyprint lang-config">
+AuthType Basic
+AuthName "By Invitation Only"
+# Optional line:
+AuthBasicProvider file
+AuthUserFile /usr/local/apache/passwd/passwords
+AuthGroupFile /usr/local/apache/passwd/groups
+Require group GroupName
+ </pre>
+
<p>Now, anyone that is listed in the group <code>GroupName</code>,
and has an entry in the <code>password</code> file, will be let in, if
@@ -328,9 +332,8 @@ person in</a></h2>
specific. Rather than creating a group file, you can just use
the following directive:</p>
- <div class="example"><p><code>
- Require valid-user
- </code></p></div>
+ <pre class="prettyprint lang-config">Require valid-user</pre>
+
<p>Using that rather than the <code>Require user rbowen</code>
line will allow anyone in that is listed in the password file,
@@ -376,17 +379,16 @@ person in</a></h2>
<p>To select a dbd file rather than a text file, for example:</p>
- <div class="example"><p><code>
- &lt;Directory /www/docs/private&gt;<br />
- <span class="indent">
- AuthName "Private"<br />
- AuthType Basic<br />
- AuthBasicProvider dbm<br />
- AuthDBMUserFile /www/passwords/passwd.dbm<br />
- Require valid-user<br />
- </span>
- &lt;/Directory&gt;
- </code></p></div>
+ <pre class="prettyprint lang-config">
+&lt;Directory /www/docs/private&gt;
+ AuthName "Private"
+ AuthType Basic
+ AuthBasicProvider dbm
+ AuthDBMUserFile /www/passwords/passwd.dbm
+ Require valid-user
+&lt;/Directory&gt;
+ </pre>
+
<p>Other options are available. Consult the
<code class="module"><a href="../mod/mod_authn_dbm.html">mod_authn_dbm</a></code> documentation for more details.</p>
@@ -401,18 +403,17 @@ person in</a></h2>
scheme that meets your needs. In the following example, both the
file and LDAP based authentication providers are being used.</p>
- <div class="example"><p><code>
- &lt;Directory /www/docs/private&gt;<br />
- <span class="indent">
- AuthName "Private"<br />
- AuthType Basic<br />
- AuthBasicProvider file ldap<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
- AuthLDAPURL ldap://ldaphost/o=yourorg<br />
- Require valid-user<br />
- </span>
- &lt;/Directory&gt;
- </code></p></div>
+ <pre class="prettyprint lang-config">
+&lt;Directory /www/docs/private&gt;
+ AuthName "Private"
+ AuthType Basic
+ AuthBasicProvider file ldap
+ AuthUserFile /usr/local/apache/passwd/passwords
+ AuthLDAPURL ldap://ldaphost/o=yourorg
+ Require valid-user
+&lt;/Directory&gt;
+ </pre>
+
<p>In this example the file provider will attempt to authenticate
the user first. If it is unable to authenticate the user, the LDAP
@@ -427,20 +428,19 @@ person in</a></h2>
authorization methods can also be used. In this example both file group
authorization as well as LDAP group authorization is being used.</p>
- <div class="example"><p><code>
- &lt;Directory /www/docs/private&gt;<br />
- <span class="indent">
- AuthName "Private"<br />
- AuthType Basic<br />
- AuthBasicProvider file<br />
- AuthUserFile /usr/local/apache/passwd/passwords<br />
+ <pre class="prettyprint lang-config">
+&lt;Directory /www/docs/private&gt;
+ AuthName "Private"
+ AuthType Basic
+ AuthBasicProvider file
+ AuthUserFile /usr/local/apache/passwd/passwords
AuthLDAPURL ldap://ldaphost/o=yourorg
- AuthGroupFile /usr/local/apache/passwd/groups<br />
- Require group GroupName<br />
- Require ldap-group cn=mygroup,o=yourorg<br />
- </span>
- &lt;/Directory&gt;
- </code></p></div>
+ AuthGroupFile /usr/local/apache/passwd/groups
+ Require group GroupName
+ Require ldap-group cn=mygroup,o=yourorg
+&lt;/Directory&gt;
+ </pre>
+
<p>To take authorization a little further, authorization container
directives such as
@@ -518,16 +518,14 @@ person in</a></h2>
that will be called during the authorization stage of the request
processing. For example:</p>
- <div class="example"><p><code>
- Require ip <var>address</var>
- </code></p></div>
+ <pre class="prettyprint lang-config">Require ip <var>address</var></pre>
+
<p>where <var>address</var> is an IP address (or a partial IP
address) or:</p>
- <div class="example"><p><code>
- Require host <var>domain_name</var>
- </code></p></div>
+ <pre class="prettyprint lang-config">Require host <var>domain_name</var></pre>
+
<p>where <var>domain_name</var> is a fully qualified domain name
(or a partial domain name); you may provide multiple addresses or
@@ -537,45 +535,38 @@ person in</a></h2>
board, and you want to keep them out, you could do the
following:</p>
- <div class="example"><p><code>
- &lt;RequireAll&gt;
- <span class="indent">
- Require all granted<br />
- Require not ip 10.252.46.165
- </span>
- &lt;/RequireAll&gt;
- </code></p></div>
+ <pre class="prettyprint lang-config">
+&lt;RequireAll&gt;
+ Require all granted
+ Require not ip 10.252.46.165
+&lt;/RequireAll&gt;
+ </pre>
+
<p>Visitors coming from that address will not be able to see
the content covered by this directive. If, instead, you have a
machine name, rather than an IP address, you can use that.</p>
- <div class="example"><p><code>
- &lt;RequireAll&gt;
- <span class="indent">
- Require all granted<br />
- Require not host <var>host.example.com</var>
- </span>
- &lt;/RequireAll&gt;
- </code></p></div>
+ <pre class="prettyprint lang-config">
+&lt;RequireAll&gt;
+ Require all granted
+ Require not host host.example.com
+&lt;/RequireAll&gt;
+ </pre>
+
<p>And, if you'd like to block access from an entire domain,
you can specify just part of an address or domain name:</p>
- <div class="example"><p><code>
- &lt;RequireAll&gt;
- <span class="indent">
- Require all granted<br />
- &lt;RequireNone&gt;
- <span class="indent">
- Require ip 192.168.205<br />
- Require host phishers.example.com moreidiots.example<br />
- Require host ke
- </span>
- &lt;/RequireNone&gt;
- </span>
- &lt;/RequireAll&gt;
- </code></p></div>
+ <pre class="prettyprint lang-config">
+&lt;RequireAll&gt;
+ Require all granted
+ Require not ip 192.168.205
+ Require not host phishers.example.com moreidiots.example
+ Require not host ke
+&lt;/RequireAll&gt;
+ </pre>
+
<p>The above example uses the <code class="directive"><a href="../mod/mod_authz_core.html#requirenone">&lt;RequireNone&gt;</a></code> directive
to make sure that none of the
@@ -629,7 +620,28 @@ person in</a></h2>
<a href="../ja/howto/auth.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
<a href="../ko/howto/auth.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
<a href="../tr/howto/auth.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
-</div><div id="footer">
+</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>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
+<script type="text/javascript"><!--//--><![CDATA[//><!--
+var comments_shortname = 'httpd';
+var comments_identifier = 'http://httpd.apache.org/docs/2.4/howto/auth.html';
+(function(w, d) {
+ if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
+ d.write('<div id="comments_thread"><\/div>');
+ var s = d.createElement('script');
+ s.type = 'text/javascript';
+ s.async = true;
+ s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
+ (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
+ }
+ else {
+ d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
+ }
+})(window, document);
+//--><!]]></script></div><div id="footer">
<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>
-<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>
+<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[//><!--
+if (typeof(prettyPrint) !== 'undefined') {
+ prettyPrint();
+}
+//--><!]]></script>
</body></html> \ No newline at end of file