[Wiki] created: HTTPAuthHowTo

Wiki Guest <[email protected]>
Newsgroups gmane.comp.horde.cvs
Message-ID <[email protected]>
guest [217.234.240.27]  Wed, 26 Nov 2008 17:56:55 -0500

Created page: http://wiki.horde.org/HTTPAuthHowTo

HTTP based authorization requests a user name and password from the  
user and compares them against a htpasswd file, in the form used by  
Apache and other web servers.

(detailed instructions pending)

Note: To make this work when PHP is run in CGI mode, you need to add  
the following rewrite rule to your htaccess file:

<code>
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</code>

Otherwise, the HTTP_AUTH_USER and HTTP_AUTH_PW fields will not be  
available to PHP. The above appears to be sufficient at least with PHP  
5.2, in earlier versions, you may need to add additional PHP code to  
extract the information from the HTTP_AUTHORIZATION into  
HTTP_AUTH_USER and HTTP_AUTH_PW, like this:

<code>
   $ha = base64_decode( substr($_SERVER['HTTP_AUTHORIZATION'],6) );
   list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =  
explode(':', $ha);
</code>


--
To unsubscribe, mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.