diff options
author | kepten <kepten@gmail.com> | 2012-02-28 04:40:55 +0100 |
---|---|---|
committer | kepten <kepten@gmail.com> | 2012-04-20 18:39:29 +0200 |
commit | 493ff10e73e346420b5386019299d2137f91eab1 (patch) | |
tree | e30f647def64fc7d57824fd06d850975b39f68d8 /Http | |
parent | 7811a3bd9a49817bfec337bcf194087d74569004 (diff) | |
download | symfony-security-493ff10e73e346420b5386019299d2137f91eab1.zip symfony-security-493ff10e73e346420b5386019299d2137f91eab1.tar.gz symfony-security-493ff10e73e346420b5386019299d2137f91eab1.tar.bz2 |
[HttpFoundation] HTTP Basic authentication is broken with PHP as cgi/fastCGI under Apache
Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #1813
Todo: -
In order to work, add this to the .htaccess:
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
Diffstat (limited to 'Http')
-rw-r--r-- | Http/Firewall/BasicAuthenticationListener.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Http/Firewall/BasicAuthenticationListener.php b/Http/Firewall/BasicAuthenticationListener.php index 9669853..e331179 100644 --- a/Http/Firewall/BasicAuthenticationListener.php +++ b/Http/Firewall/BasicAuthenticationListener.php @@ -56,7 +56,7 @@ class BasicAuthenticationListener implements ListenerInterface { $request = $event->getRequest(); - if (false === $username = $request->server->get('PHP_AUTH_USER', false)) { + if (false === $username = $request->headers->get('PHP_AUTH_USER', false)) { return; } @@ -71,7 +71,7 @@ class BasicAuthenticationListener implements ListenerInterface } try { - $token = $this->authenticationManager->authenticate(new UsernamePasswordToken($username, $request->server->get('PHP_AUTH_PW'), $this->providerKey)); + $token = $this->authenticationManager->authenticate(new UsernamePasswordToken($username, $request->headers->get('PHP_AUTH_PW'), $this->providerKey)); $this->securityContext->setToken($token); } catch (AuthenticationException $failed) { $this->securityContext->setToken(null); |