public function createFirewall($name, $config) { $config['firewall_name'] = $name; $listeners = array(); if (null === $this->firewallmap) { return $this; } $requestMatcher = new RequestMatcher(); if (array_key_exists('pattern', $config)) { $requestMatcher->matchPath($config['pattern']); } if (array_key_exists('requirements', $config)) { foreach ($config['requirements'] as $key => $value) { if (0 === strpos($key, 'HTTP-')) { $requestMatcher->matchHeader(substr($key, 5), $value); } } } if (array_key_exists('security', $config) && false === $config['security']) { $this->firewallmap->add($requestMatcher, array(), null); return $this; } $defaultProvider = reset($this->userproviders); if (array_key_exists('provider', $config) && array_key_exists($config['provider'], $this->userproviders)) { $defaultProvider = $this->userproviders[$config['provider']]; } if (array_key_exists('contexts', $this->config)) { $listeners = $this->loadContexts($config); } if (null !== $this->logout_listener && false === $this->logout_listener_added) { $this->application->getContainer()->set('security.logout_listener', $this->logout_listener); if (false === $this->dispatcher->isRestored()) { $this->dispatcher->addListener('frontcontroller.request.logout', array('@security.logout_listener', 'handle')); } $this->logout_listener_added = true; } if (0 == count($listeners)) { throw new SecurityException(sprintf('No authentication listener registered for firewall "%s".', $name)); } $this->firewallmap->add($requestMatcher, $listeners, null); return $this; }