"allowing to use GET parameter \"auth\" instead of (basic) Authentication header, as talked on devel list"

This commit is contained in:
Ralf Becker 2009-08-18 07:55:59 +00:00
parent faa51609ae
commit f70cccd2ef

View File

@ -25,13 +25,16 @@ $starttime = microtime(true);
*/ */
function check_access(&$account) function check_access(&$account)
{ {
$account = array( if (isset($_SERVER['PHP_AUTH_USER']))
'login' => $_SERVER['PHP_AUTH_USER'], {
'passwd' => $_SERVER['PHP_AUTH_PW'], $user = $_SERVER['PHP_AUTH_USER'];
'passwd_type' => 'text', $pass = $_SERVER['PHP_AUTH_PW'];
); }
if (!isset($_SERVER['PHP_AUTH_USER']) || elseif(isset($_GET['auth']))
!($sessionid = $GLOBALS['egw']->session->create($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'],'text'))) {
list($user,$pass) = explode(':',base64_decode($_GET['auth']),2);
}
if (!isset($user) || !($sessionid = $GLOBALS['egw']->session->create($user,$pass,'text')))
{ {
header('WWW-Authenticate: Basic realm="'.vfs_webdav_server::REALM. header('WWW-Authenticate: Basic realm="'.vfs_webdav_server::REALM.
// if the session class gives a reason why the login failed --> append it to the REALM // if the session class gives a reason why the login failed --> append it to the REALM
@ -87,9 +90,8 @@ catch (egw_exception_no_permission_app $e)
throw $e; throw $e;
} }
} }
$headertime = microtime(true); //$headertime = microtime(true);
$webdav_server = new vfs_webdav_server(); $webdav_server = new vfs_webdav_server();
$webdav_server->ServeRequest(); $webdav_server->ServeRequest();
//error_log(sprintf("WebDAV %s request took %5.3f s (header include took %5.3f s)",$_SERVER['REQUEST_METHOD'],microtime(true)-$starttime,$headertime-$starttime)); //error_log(sprintf("WebDAV %s request took %5.3f s (header include took %5.3f s)",$_SERVER['REQUEST_METHOD'],microtime(true)-$starttime,$headertime-$starttime));