Dominique Bongiraud 14 rokov pred
rodič
commit
66ff8073b9

+ 16 - 15
src/Symfony/Component/Security/Authentication/Provider/UserAuthenticationProvider.php

@@ -41,16 +41,6 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter
         $this->hideUserNotFoundExceptions = $hideUserNotFoundExceptions;
     }
 
-    /**
-     * Does additional checks on the user and token (like validating the credentials).
-     *
-     * @param AccountInterface      $account The retrieved AccountInterface instance
-     * @param UsernamePasswordToken $token   The UsernamePasswordToken token to be authenticated
-     *
-     * @throws AuthenticationException if the credentials could not be validated
-     */
-    abstract protected function checkAuthentication(AccountInterface $account, UsernamePasswordToken $token);
-
     /**
      * {@inheritdoc}
      */
@@ -88,6 +78,14 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter
         return new UsernamePasswordToken($user, $token->getCredentials(), $user->getRoles());
     }
 
+    /**
+     * {@inheritdoc}
+     */
+    public function supports(TokenInterface $token)
+    {
+        return $token instanceof UsernamePasswordToken;
+    }
+
     /**
      * Retrieves the user from an implementation-specific location.
      *
@@ -101,10 +99,13 @@ abstract class UserAuthenticationProvider implements AuthenticationProviderInter
     abstract protected function retrieveUser($username, UsernamePasswordToken $token);
 
     /**
-     * {@inheritdoc}
+     * Does additional checks on the user and token (like validating the
+     * credentials).
+     *
+     * @param AccountInterface      $account The retrieved AccountInterface instance
+     * @param UsernamePasswordToken $token   The UsernamePasswordToken token to be authenticated
+     *
+     * @throws AuthenticationException if the credentials could not be validated
      */
-    public function supports(TokenInterface $token)
-    {
-        return $token instanceof UsernamePasswordToken;
-    }
+    abstract protected function checkAuthentication(AccountInterface $account, UsernamePasswordToken $token);
 }

+ 1 - 1
src/Symfony/Component/Security/Authentication/Token/TokenInterface.php

@@ -23,7 +23,7 @@ interface TokenInterface extends \Serializable
      *
      * @return string A string representation
      */
-    public function __toString();
+    function __toString();
 
     /**
      * Returns the user roles.

+ 1 - 2
src/Symfony/Component/Security/Authentication/Token/UsernamePasswordToken.php

@@ -36,8 +36,7 @@ class UsernamePasswordToken extends Token
      */
     public function setAuthenticated($isAuthenticated)
     {
-        if ($isAuthenticated)
-        {
+        if ($isAuthenticated) {
             throw new \LogicException('Cannot set this token to trusted after instantiation.');
         }
 

+ 3 - 2
src/Symfony/Component/Security/Authorization/AccessDecisionManager.php

@@ -23,9 +23,9 @@ use Symfony\Component\Security\Authentication\Token\TokenInterface;
 class AccessDecisionManager implements AccessDecisionManagerInterface
 {
     protected $voters;
+    protected $strategy;
     protected $allowIfAllAbstainDecisions;
     protected $allowIfEqualGrantedDeniedDecisions;
-    protected $strategy;
 
     /**
      * Constructor.
@@ -104,7 +104,8 @@ class AccessDecisionManager implements AccessDecisionManagerInterface
     /**
      * {@inheritdoc}
      */
-    public function supportsClass($class) {
+    public function supportsClass($class)
+    {
         foreach ($this->voters as $voter) {
             if ($voter->supportsClass($class)) {
                 return true;

+ 1 - 1
src/Symfony/Component/Security/Role/RoleHierarchyInterface.php

@@ -29,5 +29,5 @@ interface RoleHierarchyInterface
      *
      * @return array An array of all reachable roles
      */
-    public function getReachableRoles(array $roles);
+    function getReachableRoles(array $roles);
 }

+ 2 - 2
src/Symfony/Component/Security/SecurityContext.php

@@ -64,7 +64,7 @@ class SecurityContext
      *
      * @return TokenInterface|null A TokenInterface instance or null if no authentication information is available
      */
-    function getToken()
+    public function getToken()
     {
         return $this->token;
     }
@@ -74,7 +74,7 @@ class SecurityContext
      *
      * @param TokenInterface $token A TokenInterface token, or null if no further authentication information should be stored
      */
-    function setToken(TokenInterface $token = null)
+    public function setToken(TokenInterface $token = null)
     {
         $this->token = $token;
     }