93 lines
4.3 KiB
HTML
93 lines
4.3 KiB
HTML
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
|
||
lang="en" dir="ltr">
|
||
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
<title></title>
|
||
<!-- metadata -->
|
||
<meta name="generator" content="Offline" />
|
||
<meta name="version" content="Offline 0.1" />
|
||
<!-- style sheet links -->
|
||
<link rel="stylesheet" media="all" type="text/css" href="../../../../css/all.css" />
|
||
<link rel="stylesheet" media="screen" type="text/css" href="../../../../css/screen.css" />
|
||
<link rel="stylesheet" media="print" type="text/css" href="../../../../css/print.css" />
|
||
|
||
</head>
|
||
<body>
|
||
<div class="dokuwiki export">
|
||
|
||
|
||
<h1 class="sectionedit1" id="http_basic_authentication">HTTP Basic Authentication</h1>
|
||
<div class="level1">
|
||
|
||
<p>
|
||
<a href="/_detail/applications/http_logo.png?id=documentation%3A2.0%3Aapplications%3Aauthbasic" class="media" title="applications:http_logo.png"><img src="../../../../media/icons/kmultiple.png" class="mediacenter" alt="" /></a>
|
||
</p>
|
||
|
||
</div>
|
||
<!-- EDIT1 SECTION "HTTP Basic Authentication" [1-77] -->
|
||
<h2 class="sectionedit2" id="presentation">Presentation</h2>
|
||
<div class="level2">
|
||
|
||
<p>
|
||
<p><div class="noteimportant">For now, this feature is only supported by Apache handler.
|
||
</div></p>
|
||
</p>
|
||
|
||
<p>
|
||
Extract from the <a href="http://en.wikipedia.org/wiki/Basic_access_authentication" class="urlextern" title="http://en.wikipedia.org/wiki/Basic_access_authentication" rel="nofollow">Wikipedia article</a>:
|
||
</p>
|
||
|
||
<p>
|
||
<blockquote>
|
||
In the context of an HTTP transaction, the basic access authentication is a method designed to allow a web browser, or other client program, to provide credentials – in the form of a user name and password – when making a request.
|
||
</p>
|
||
|
||
<p>
|
||
Before transmission, the username and password are encoded as a sequence of base-64 characters. For example, the user name Aladdin and password open sesame would be combined as Aladdin:open sesame – which is equivalent to QWxhZGRpbjpvcGVuIHNlc2FtZQ== when encoded in Base64. Little effort is required to translate the encoded string back into the user name and password, and many popular security tools will decode the strings “on the fly”.
|
||
</blockquote>
|
||
</p>
|
||
|
||
<p>
|
||
So HTTP Basic Autentication is managed trough an HTTP header (<code>Authorization</code>), that can be forged by <abbr title="LemonLDAP::NG">LL::NG</abbr>, with this precautions:
|
||
</p>
|
||
<ul>
|
||
<li class="level1"><div class="li"> Data should not contains accents or special characters, as HTTP protocol only allow <abbr title="American Standard Code for Information Interchange">ASCII</abbr> values in header (but depending on the HTTP server, you can use ISO encoded values)</div>
|
||
</li>
|
||
<li class="level1"><div class="li"> You need to forward the password, which can be the user main password (if <a href="../../../documentation/2.0/passwordstore.html" class="wikilink1" title="documentation:2.0:passwordstore">password is stored in session</a>, or any user attribute (if you keep secondary passwords in users database).</div>
|
||
</li>
|
||
</ul>
|
||
|
||
</div>
|
||
<!-- EDIT2 SECTION "Presentation" [78-1535] -->
|
||
<h2 class="sectionedit3" id="configuration">Configuration</h2>
|
||
<div class="level2">
|
||
|
||
<p>
|
||
The Basic Authentication relies on a specific HTTP header, as described above. So you have just to declare this header for the virtual host in Manager.
|
||
</p>
|
||
|
||
<p>
|
||
For example, to forward login (<code>$uid</code>) and password (<code>$_password</code> if <a href="../../../documentation/2.0/passwordstore.html" class="wikilink1" title="documentation:2.0:passwordstore">password is stored in session</a>):
|
||
</p>
|
||
<pre class="code">Authorization => "Basic ".encode_base64("$uid:$_password")</pre>
|
||
|
||
<p>
|
||
<abbr title="LemonLDAP::NG">LL::NG</abbr> provides a special function named <a href="../../../documentation/2.0/extendedfunctions.html#basic" class="wikilink1" title="documentation:2.0:extendedfunctions">basic</a> to build this header.
|
||
</p>
|
||
|
||
<p>
|
||
So the above example can also be written like this:
|
||
</p>
|
||
<pre class="code">Authorization => basic($uid,$_password)</pre>
|
||
|
||
<p>
|
||
<p><div class="notetip">The <code>basic</code> function will also force conversion from UTF-8 to ISO-8859-1, which should be accepted by most of HTTP servers.
|
||
</div></p>
|
||
</p>
|
||
|
||
</div>
|
||
</div><!-- closes <div class="dokuwiki export">--> |