From 8f82770ba34f62cb5c5a2fada8968df4a38569ef Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Mon, 25 Nov 2013 12:09:57 +0200 Subject: [PATCH] fix WWW-Authenticate --- application/Espo/Core/Application.php | 2 +- application/Espo/Core/Utils/Api/Auth.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/application/Espo/Core/Application.php b/application/Espo/Core/Application.php index 89048eba8d..81c944b19e 100644 --- a/application/Espo/Core/Application.php +++ b/application/Espo/Core/Application.php @@ -184,7 +184,7 @@ EOT; return array( 'controller' => 'Settings', ); - }); + })->conditions( array('auth' => false) ); $this->getSlim()->map('/settings/', function() { return array( 'controller' => 'Settings', diff --git a/application/Espo/Core/Utils/Api/Auth.php b/application/Espo/Core/Utils/Api/Auth.php index 5385aa5b93..55a512998c 100644 --- a/application/Espo/Core/Utils/Api/Auth.php +++ b/application/Espo/Core/Utils/Api/Auth.php @@ -10,8 +10,6 @@ class Auth extends \Slim\Middleware private $container; - protected $realm = ''; - public function __construct(\Doctrine\ORM\EntityManager $entityManager, \Espo\Core\Container $container) { $this->entityManager = $entityManager; @@ -60,11 +58,11 @@ class Auth extends \Slim\Middleware if ($isAuthenticated) { $this->next->call(); } else { - $res->header('WWW-Authenticate', sprintf('Basic realm="%s"', $this->realm)); + $res->header('WWW-Authenticate'); $res->status(401); } } else { - $res->header('WWW-Authenticate', sprintf('Basic realm="%s"', $this->realm)); + $res->header('WWW-Authenticate'); $res->status(401); } }