"Support for basic auth when using PHP CGI"

This commit is contained in:
Ralf Becker 2010-05-13 08:49:32 +00:00
parent 867adfaa11
commit 46fd3ad561

View File

@ -61,6 +61,15 @@ class egw_digest_auth
$realm = $GLOBALS['egw_info']['flags']['auth_realm']; $realm = $GLOBALS['egw_info']['flags']['auth_realm'];
if (empty($realm)) $realm = 'EGroupware'; if (empty($realm)) $realm = 'EGroupware';
// Support for basic auth when using PHP CGI (what about digest auth?)
if (!isset($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['Authorization']) && strpos($_SERVER['Authorization'],'Basic ') === 0)
{
$hash = base64_decode(substr($_SERVER['Authorization'],6));
if (strpos($hash, ':') !== false)
{
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', $hash, 2);
}
}
if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_DIGEST']) || if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['PHP_AUTH_DIGEST']) ||
isset($_SERVER['PHP_AUTH_DIGEST']) && (!self::is_valid($realm,$_SERVER['PHP_AUTH_DIGEST'],$username,$password) || isset($_SERVER['PHP_AUTH_DIGEST']) && (!self::is_valid($realm,$_SERVER['PHP_AUTH_DIGEST'],$username,$password) ||
!($sessionid = $GLOBALS['egw']->session->create($username,$password,'text'))) || !($sessionid = $GLOBALS['egw']->session->create($username,$password,'text'))) ||