diff options
author | Fabien Potencier <fabien.potencier@gmail.com> | 2014-04-22 10:11:06 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2014-04-22 10:11:06 +0200 |
commit | 013e84fe863ea6de2f314ae5b813e9fc51aabe55 (patch) | |
tree | 9adda823f62d198ab187c1b7398ea8b377b44cac /Http/Firewall | |
parent | c70001ec82326f9581814ac002af6b904d24c4cd (diff) | |
parent | 8fe3c7d8710f0eab18a505122a8839a8bce9815c (diff) | |
download | symfony-security-013e84fe863ea6de2f314ae5b813e9fc51aabe55.zip symfony-security-013e84fe863ea6de2f314ae5b813e9fc51aabe55.tar.gz symfony-security-013e84fe863ea6de2f314ae5b813e9fc51aabe55.tar.bz2 |
Merge branch '2.3' into 2.4
* 2.3:
fix docblock
Fixed incompatibility of x509 auth with nginx
[Process] Setting STDIN while running should not be possible
[FrameworkBundle] improve English in RouterMatchCommand
[Doctrine Bridge] simplify session handler by using main connection
Conflicts:
src/Symfony/Component/Process/Tests/AbstractProcessTest.php
Diffstat (limited to 'Http/Firewall')
-rw-r--r-- | Http/Firewall/X509AuthenticationListener.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Http/Firewall/X509AuthenticationListener.php b/Http/Firewall/X509AuthenticationListener.php index 5aabf75..9c07be1 100644 --- a/Http/Firewall/X509AuthenticationListener.php +++ b/Http/Firewall/X509AuthenticationListener.php @@ -41,10 +41,17 @@ class X509AuthenticationListener extends AbstractPreAuthenticatedListener */ protected function getPreAuthenticatedData(Request $request) { - if (!$request->server->has($this->userKey)) { - throw new BadCredentialsException(sprintf('SSL key was not found: %s', $this->userKey)); + $user = null; + if ($request->server->has($this->userKey)) { + $user = $request->server->get($this->userKey); + } elseif ($request->server->has($this->credentialKey) && preg_match('#/emailAddress=(.+\@.+\..+)(/|$)#', $request->server->get($this->credentialKey), $matches)) { + $user = $matches[1]; } - return array($request->server->get($this->userKey), $request->server->get($this->credentialKey, '')); + if (null === $user) { + throw new BadCredentialsException(sprintf('SSL credentials not found: %s, %s', $this->userKey, $this->credentialKey)); + } + + return array($user, $request->server->get($this->credentialKey, '')); } } |