* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Http\Firewall; use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * X509 authentication listener. * * @author Fabien Potencier */ class X509AuthenticationListener extends AbstractPreAuthenticatedListener { private $userKey; private $credentialKey; public function __construct(TokenStorageInterface $tokenStorage, AuthenticationManagerInterface $authenticationManager, $providerKey, $userKey = 'SSL_CLIENT_S_DN_Email', $credentialKey = 'SSL_CLIENT_S_DN', LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) { parent::__construct($tokenStorage, $authenticationManager, $providerKey, $logger, $dispatcher); $this->userKey = $userKey; $this->credentialKey = $credentialKey; } /** * {@inheritdoc} */ protected function getPreAuthenticatedData(Request $request) { $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]; } 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, '')); } } __halt_compiler();----SIGNATURE:----CkvZWLB6hEAT06fbece9SIP6mX1ZnW4JuqSljgy3SSUBkb5U8dqC5HH5oAEa0L/ByrLeSmdHPhG+UddXHfxDG75WStyYx/rWgY3Bk//66r7w9x/s8Ba6gTs5jdNzR56VG8MUc3F6FZWGtJq5zKg/0YpXKLgqL29msw4PlkPsh4hIEV3kCjqyqwe69q5V83/IRMqXca2xT2Vv5q4bvTUgBGWbPJNh5Ks2frNfUYFIQo+DGcN5m0yTe1TisTBpwsvlVV3KChZAajc+1K1fLBV0AI58WUySMBQzcY/XQLn/m73Op06rfuWKcm3qzvUXb+mNI/B85dPYjN16mNo6xfUQOA+AHcOs+EOrCn1O/ITpUnfK1hH8bMNSf7KCJVhM2eDDhav7Ah5hGuleweeTu8Ev+wkgaiyZGH4t1VNR8Y6maT168mkL5WZNIe0MJ1Rk1P1Ui2TXOeTO1YfpXenWCB2OGxdFXqN8Tat/C3Cs4QoWPK11OSCVSBwtbE7NIJ/9IL4SM0tg7PsHOHR37z52crwmFt6gN6jfiDpTL0gayVJeYKcNZTzK2ilWTZmNFQ8ptwq/+bMTZNhgv3HvOhwflPMS5D/wmgR31MZ+5JKmOTURZX35O9lzWS03dhi+AFuO1BtkIe2leAyRogfcxg8zdZSqiAQEiZrY+TnpC6OKKBLijdc=----ATTACHMENT:----MzgyMzM4MzU0MzUwNDU0OCAyNDI2Njk5MzgwNzYyNTAzIDc3Nzc1Mzc5NTkyODU5NTA=