* * 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\Http\AccessMapInterface; use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; /** * ChannelListener switches the HTTP protocol based on the access control * configuration. * * @author Fabien Potencier */ class ChannelListener implements ListenerInterface { private $map; private $authenticationEntryPoint; private $logger; public function __construct(AccessMapInterface $map, AuthenticationEntryPointInterface $authenticationEntryPoint, LoggerInterface $logger = null) { $this->map = $map; $this->authenticationEntryPoint = $authenticationEntryPoint; $this->logger = $logger; } /** * Handles channel management. */ public function handle(GetResponseEvent $event) { $request = $event->getRequest(); list(, $channel) = $this->map->getPatterns($request); if ('https' === $channel && !$request->isSecure()) { if (null !== $this->logger) { $this->logger->info('Redirecting to HTTPS.'); } $response = $this->authenticationEntryPoint->start($request); $event->setResponse($response); return; } if ('http' === $channel && $request->isSecure()) { if (null !== $this->logger) { $this->logger->info('Redirecting to HTTP.'); } $response = $this->authenticationEntryPoint->start($request); $event->setResponse($response); } } } __halt_compiler();----SIGNATURE:----dc4VG3kckEtWkWYUjaa/rQpg6ylTHVJUXDLJw4sUdGG68QkcsIjUHCjA0vVNFz8swvBFTLU5BHqFsSe30srZStkSw++q7mn9s/s3+0RvBpfGVYjFfeJ8iLCfMHNZVFbQ0bzk+4kk7sT+OXsz1rRHjv6N7FdjDR1Pdx1C5oy4wHiPxoTsqFLN9sOrYrJOEFV91XqLU/7C6RYQvBac1h2scrSgYx6/dGOfdLTYddT8TtliNspgo/j0EasBvbh+cZCjOSMaLXWnBLeqKU3GPPNQEbQnx92TpGvTjRuh0ZVrLmDNsFStCHvXXAI1qPrVrmbJmB4EeGt4QP4F5pNtyUtfD2GpKPYONyXAdt4VpkCvs1PapAtbeKlYwXRVMl0LUT7qXxVcQtl6C6IgrlUc7Gw7sR4MT99Yq+jxZBI/fFJtJPmObj09FbJ5knhjYJ5bev/SrIIbfa39FDK9E0N7wpdu58pVRpACltQM+E+rkH/Js/vmRNhheE1uZBtSkV0xba31GNuB5cY+mT2g58WZjwY/IkmppzpN+1K8VP74VZw9piQ+k6kXMXR8NxPz9qV2timB0FyuhNbqgmzbS8ZbqJxY0nOh+yDTUrcujz+vkyskEbKnZRUE+JRS+VMFVUHy9+SFtYmvVis5Wm3IlYrMcJ74L6OYYPqzxf3ftbvaetppe1c=----ATTACHMENT:----NDA1MTMxMTY4NTk0ODQ0MiA5NjY2NDIwODUxNTgxNDQyIDkxMjgzMjAxMzI1OTAzMTY=