diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index bf13395365941..728840a090d42 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -171,6 +171,7 @@ private function createAuthorization($config, ContainerBuilder $container) } $this->addClassesToCompile(array( + 'Symfony\\Component\\Security\\Http\\AccessMapInterface', 'Symfony\\Component\\Security\\Http\\AccessMap', )); diff --git a/src/Symfony/Component/Security/Http/AccessMap.php b/src/Symfony/Component/Security/Http/AccessMap.php index 6d12b4227021c..de78e15a55c0c 100644 --- a/src/Symfony/Component/Security/Http/AccessMap.php +++ b/src/Symfony/Component/Security/Http/AccessMap.php @@ -20,7 +20,7 @@ * * @author Fabien Potencier */ -class AccessMap +class AccessMap implements AccessMapInterface { private $map = array(); diff --git a/src/Symfony/Component/Security/Http/AccessMapInterface.php b/src/Symfony/Component/Security/Http/AccessMapInterface.php new file mode 100644 index 0000000000000..dbd7282540d04 --- /dev/null +++ b/src/Symfony/Component/Security/Http/AccessMapInterface.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http; + +use Symfony\Component\HttpFoundation\Request; + +/** + * AccessMap allows configuration of different access control rules for + * specific parts of the website. + * + * @author Fabien Potencier + * @author Kris Wallsmith + */ +interface AccessMapInterface +{ + /** + * Returns security attributes and required channel for the supplied request. + * + * @param Request $request The current request + * + * @return array A tuple of security attributes and the required channel + */ + function getPatterns(Request $request); +} diff --git a/src/Symfony/Component/Security/Http/Firewall/AccessListener.php b/src/Symfony/Component/Security/Http/Firewall/AccessListener.php index 877b6c353a651..3e2d3a5329c62 100644 --- a/src/Symfony/Component/Security/Http/Firewall/AccessListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/AccessListener.php @@ -13,7 +13,7 @@ use Symfony\Component\Security\Core\SecurityContextInterface; use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; -use Symfony\Component\Security\Http\AccessMap; +use Symfony\Component\Security\Http\AccessMapInterface; use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; use Symfony\Component\HttpKernel\Log\LoggerInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; @@ -33,7 +33,7 @@ class AccessListener implements ListenerInterface private $authManager; private $logger; - public function __construct(SecurityContextInterface $context, AccessDecisionManagerInterface $accessDecisionManager, AccessMap $map, AuthenticationManagerInterface $authManager, LoggerInterface $logger = null) + public function __construct(SecurityContextInterface $context, AccessDecisionManagerInterface $accessDecisionManager, AccessMapInterface $map, AuthenticationManagerInterface $authManager, LoggerInterface $logger = null) { $this->context = $context; $this->accessDecisionManager = $accessDecisionManager; diff --git a/src/Symfony/Component/Security/Http/Firewall/ChannelListener.php b/src/Symfony/Component/Security/Http/Firewall/ChannelListener.php index 847753f03285d..9b0f8c63db373 100644 --- a/src/Symfony/Component/Security/Http/Firewall/ChannelListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/ChannelListener.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Security\Http\Firewall; -use Symfony\Component\Security\Http\AccessMap; +use Symfony\Component\Security\Http\AccessMapInterface; use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; use Symfony\Component\HttpKernel\Log\LoggerInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; @@ -28,7 +28,7 @@ class ChannelListener implements ListenerInterface private $authenticationEntryPoint; private $logger; - public function __construct(AccessMap $map, AuthenticationEntryPointInterface $authenticationEntryPoint, LoggerInterface $logger = null) + public function __construct(AccessMapInterface $map, AuthenticationEntryPointInterface $authenticationEntryPoint, LoggerInterface $logger = null) { $this->map = $map; $this->authenticationEntryPoint = $authenticationEntryPoint; diff --git a/tests/Symfony/Tests/Component/Security/Http/Firewall/AccessListenerTest.php b/tests/Symfony/Tests/Component/Security/Http/Firewall/AccessListenerTest.php index df369d064b18c..4736f32088883 100644 --- a/tests/Symfony/Tests/Component/Security/Http/Firewall/AccessListenerTest.php +++ b/tests/Symfony/Tests/Component/Security/Http/Firewall/AccessListenerTest.php @@ -13,7 +13,7 @@ public function testHandleWhenTheAccessDecisionManagerDecidesToRefuseAccess() { $request = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false); - $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMap'); + $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMapInterface'); $accessMap ->expects($this->any()) ->method('getPatterns') @@ -64,7 +64,7 @@ public function testHandleWhenTheTokenIsNotAuthenticated() { $request = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false); - $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMap'); + $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMapInterface'); $accessMap ->expects($this->any()) ->method('getPatterns') @@ -135,7 +135,7 @@ public function testHandleWhenThereIsNoAccessMapEntryMatchingTheRequest() { $request = $this->getMock('Symfony\Component\HttpFoundation\Request', array(), array(), '', false, false); - $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMap'); + $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMapInterface'); $accessMap ->expects($this->any()) ->method('getPatterns') @@ -188,7 +188,7 @@ public function testHandleWhenTheSecurityContextHasNoToken() $listener = new AccessListener( $context, $this->getMock('Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface'), - $this->getMock('Symfony\Component\Security\Http\AccessMap'), + $this->getMock('Symfony\Component\Security\Http\AccessMapInterface'), $this->getMock('Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface') ); diff --git a/tests/Symfony/Tests/Component/Security/Http/Firewall/ChannelListenerTest.php b/tests/Symfony/Tests/Component/Security/Http/Firewall/ChannelListenerTest.php index fafdba6c6deec..1f45f61e53de0 100644 --- a/tests/Symfony/Tests/Component/Security/Http/Firewall/ChannelListenerTest.php +++ b/tests/Symfony/Tests/Component/Security/Http/Firewall/ChannelListenerTest.php @@ -17,7 +17,7 @@ public function testHandleWithNotSecuredRequestAndHttpChannel() ->will($this->returnValue(false)) ; - $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMap'); + $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMapInterface'); $accessMap ->expects($this->any()) ->method('getPatterns') @@ -55,7 +55,7 @@ public function testHandleWithSecuredRequestAndHttpsChannel() ->will($this->returnValue(true)) ; - $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMap'); + $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMapInterface'); $accessMap ->expects($this->any()) ->method('getPatterns') @@ -95,7 +95,7 @@ public function testHandleWithNotSecuredRequestAndHttpsChannel() $response = new Response(); - $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMap'); + $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMapInterface'); $accessMap ->expects($this->any()) ->method('getPatterns') @@ -138,7 +138,7 @@ public function testHandleWithSecuredRequestAndHttpChannel() $response = new Response(); - $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMap'); + $accessMap = $this->getMock('Symfony\Component\Security\Http\AccessMapInterface'); $accessMap ->expects($this->any()) ->method('getPatterns') pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy