From 9c043eacd405b96a7f05cd83484a8ddba73a711a Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Thu, 13 Mar 2014 12:04:04 +0200 Subject: [PATCH 1/4] fix http basic auth issue --- application/Espo/Core/Utils/Api/Auth.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/application/Espo/Core/Utils/Api/Auth.php b/application/Espo/Core/Utils/Api/Auth.php index beeb952142..ab0cd40dc1 100644 --- a/application/Espo/Core/Utils/Api/Auth.php +++ b/application/Espo/Core/Utils/Api/Auth.php @@ -1,4 +1,4 @@ -headers('PHP_AUTH_USER'); - $authSec = $req->headers('PHP_AUTH_PW'); + $authSec = $req->headers('PHP_AUTH_PW'); + + $httpEspo = $req->headers('HTTP_ESPO'); + if (isset($httpEspo)) { + $credentials = explode(':', base64_decode($httpEspo)); + $authKey = $credentials[0]; + $authSec = $credentials[1]; + } if ($authKey && $authSec) { $isAuthenticated = false; From 49649b5cf626fbe60ca9efe388a98b1032b1861c Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Thu, 13 Mar 2014 12:37:13 +0200 Subject: [PATCH 2/4] add main.html to ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 72a04b8bae..c9e69cf7d4 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ build node_modules client test.php +main.html From 42434aed175f9f74468f6f5293c2b6cbbd835d34 Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Thu, 13 Mar 2014 15:20:11 +0200 Subject: [PATCH 3/4] fixed IE problem with caching application/json request --- application/Espo/Core/Application.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/application/Espo/Core/Application.php b/application/Espo/Core/Application.php index 40937c6d96..603fdb9547 100644 --- a/application/Espo/Core/Application.php +++ b/application/Espo/Core/Application.php @@ -1,4 +1,4 @@ -getSlim()->hook('slim.after.router', function () use (&$slim) { $slim->contentType('application/json'); + + $res = $slim->response(); + $res->header('Expires', '0'); + $res->header('Last-Modified', gmdate("D, d M Y H:i:s") . " GMT"); + $res->header('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0'); + $res->header('Pragma', 'no-cache'); }); } From 743b36ecb265b7fa933a07f4ce98705308ccd252 Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Fri, 14 Mar 2014 11:50:06 +0200 Subject: [PATCH 4/4] chaage header to 'Espo-Authorization' --- application/Espo/Core/Utils/Api/Auth.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/Espo/Core/Utils/Api/Auth.php b/application/Espo/Core/Utils/Api/Auth.php index ab0cd40dc1..1b853a60e5 100644 --- a/application/Espo/Core/Utils/Api/Auth.php +++ b/application/Espo/Core/Utils/Api/Auth.php @@ -68,9 +68,9 @@ class Auth extends \Slim\Middleware $authKey = $req->headers('PHP_AUTH_USER'); $authSec = $req->headers('PHP_AUTH_PW'); - $httpEspo = $req->headers('HTTP_ESPO'); - if (isset($httpEspo)) { - $credentials = explode(':', base64_decode($httpEspo)); + $espoAuth = $req->headers('HTTP_ESPO_AUTHORIZATION'); + if (isset($espoAuth)) { + $credentials = explode(':', base64_decode($espoAuth)); $authKey = $credentials[0]; $authSec = $credentials[1]; }