Properly check X-Requested-With header in case of multiple values

Saw this happening in IE8...
This commit is contained in:
Vincent Petry 2015-12-11 11:22:38 +01:00
parent df15d54db6
commit 13ec2bda2d
1 changed files with 1 additions and 1 deletions

View File

@ -160,7 +160,7 @@ class Auth extends AbstractBasic {
return [true, $this->principalPrefix . $user];
}
if (!$this->userSession->isLoggedIn() && $request->getHeader('X-Requested-With') === 'XMLHttpRequest') {
if (!$this->userSession->isLoggedIn() && in_array('XMLHttpRequest', explode(',', $request->getHeader('X-Requested-With')))) {
// do not re-authenticate over ajax, use dummy auth name to prevent browser popup
$response->addHeader('WWW-Authenticate','DummyBasic realm="' . $this->realm . '"');
$response->setStatus(401);