fixed issue with Basic Authorization for cgi/fastcgi

This commit is contained in:
Taras Machyshyn
2014-07-01 17:41:26 +03:00
parent 0a2469aaa4
commit 30b246f67c
3 changed files with 10 additions and 3 deletions

View File

@@ -4,5 +4,7 @@ RedirectMatch 403 \.config$
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_ESPO_CGI_AUTH:%{HTTP:Authorization}]
RewriteRule reset/?$ reset.html [QSA,L]
</IfModule>

View File

@@ -6,5 +6,7 @@ RewriteEngine On
#
# RewriteBase /
RewriteRule .* - [E=HTTP_ESPO_CGI_AUTH:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

View File

@@ -51,9 +51,12 @@ class Auth extends \Slim\Middleware
$espoAuth = $req->headers('HTTP_ESPO_AUTHORIZATION');
if (isset($espoAuth)) {
$credentials = explode(':', base64_decode($espoAuth));
$authUsername = $credentials[0];
$authPassword = $credentials[1];
list($authUsername, $authPassword) = explode(':', base64_decode($espoAuth));
}
$espoCgiAuth = $req->headers('HTTP_ESPO_CGI_AUTH');
if ( !isset($authUsername) && !isset($authPassword) && isset($espoCgiAuth) ) {
list($authUsername, $authPassword) = explode(':' , base64_decode(substr($espoCgiAuth, 6)));
}
if (is_null($this->authRequired)) {