Переглянути джерело

Merge remote branch 'schmittjoh/security'

Fabien Potencier 14 роки тому
батько
коміт
58bf229856

+ 1 - 1
src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml

@@ -126,7 +126,7 @@
         <service id="security.user.provider.entity" class="%security.user.provider.entity.class%" abstract="true" public="false">
             <argument type="service" id="security.user.entity_manager" />
         </service>
-        <service id="security.user.entity_manager" alias="doctrine.orm.default_entity_manager" public="false" />
+        <service id="security.user.entity_manager" alias="doctrine.orm.entity_manager" public="false" />
 
         <service id="security.user.provider.in_memory" class="%security.user.provider.in_memory.class%" abstract="true" public="false" />
         <service id="security.user.provider.in_memory.user" class="%security.user.provider.in_memory.user.class%" abstract="true" public="false" />

+ 1 - 1
src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

@@ -184,7 +184,7 @@ class XmlFileLoader extends FileLoader
         }
 
         if (isset($service['parent'])) {
-            $definition = new DefinitionDecorator($service['parent']);
+            $definition = new DefinitionDecorator((string) $service['parent']);
         } else {
             $definition = new Definition();
         }

+ 4 - 0
src/Symfony/Component/Security/Core/Authentication/AuthenticationProviderManager.php

@@ -59,6 +59,10 @@ class AuthenticationProviderManager implements AuthenticationManagerInterface
 
             try {
                 $result = $provider->authenticate($token);
+
+                if (null !== $result) {
+                    break;
+                }
             } catch (AccountStatusException $e) {
                 $e->setExtraInformation($token);
 

+ 7 - 2
tests/Symfony/Tests/Component/Security/Core/Authentication/AuthenticationProviderManagerTest.php

@@ -80,11 +80,16 @@ class AuthenticationProviderManagerTest extends \PHPUnit_Framework_TestCase
         $this->assertSame($expected, $token);
     }
 
-    public function testAuthenticateReturnsTokenForTheLastMatch()
+    public function testAuthenticateReturnsTokenOfTheFirstMatchingProvider()
     {
+        $second = $this->getMock('Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface');
+        $second
+            ->expects($this->never())
+            ->method('supports')
+        ;
         $manager = new AuthenticationProviderManager(array(
-            $this->getAuthenticationProvider(true, $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')),
             $this->getAuthenticationProvider(true, $expected = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')),
+            $second,
         ));
 
         $token = $manager->authenticate($this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));