Forráskód Böngészése

merged branch schmittjoh/abstractAuthenticationListener (PR #1683)

Commits
-------

29e4063 [Security] changed order of checks to check for more specific things first

Discussion
----------

[Security] changed order of checks
Fabien Potencier 14 éve
szülő
commit
ae092b9482

+ 8 - 8
src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php

@@ -126,19 +126,19 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
             return;
             return;
         }
         }
 
 
-        try {
-            if (null === $returnValue = $this->attemptAuthentication($request)) {
-                return;
-            }
-
-            if (!$request->hasSession()) {
-                throw new \RuntimeException('This authentication method requires a session.');
-            }
+        if (!$request->hasSession()) {
+            throw new \RuntimeException('This authentication method requires a session.');
+        }
 
 
+        try {
             if (!$request->hasPreviousSession()) {
             if (!$request->hasPreviousSession()) {
                 throw new SessionUnavailableException('Your session has timed-out, or you have disabled cookies.');
                 throw new SessionUnavailableException('Your session has timed-out, or you have disabled cookies.');
             }
             }
 
 
+            if (null === $returnValue = $this->attemptAuthentication($request)) {
+                return;
+            }
+
             if ($returnValue instanceof TokenInterface) {
             if ($returnValue instanceof TokenInterface) {
                 $this->sessionStrategy->onAuthentication($request, $returnValue);
                 $this->sessionStrategy->onAuthentication($request, $returnValue);