diff options
author | Ryan Weaver <ryan@thatsquality.com> | 2015-05-17 18:16:06 -0400 |
---|---|---|
committer | Ryan Weaver <ryan@thatsquality.com> | 2015-09-20 19:24:21 -0400 |
commit | 5fa45716c9461a07f03428754d2bb05a0e6f2943 (patch) | |
tree | 27b675465cbc2a7e93ed806cac2571964f2c2233 | |
parent | 43d1a03737bdc39a9e70c7b6bc7792c912b46082 (diff) | |
download | symfony-security-5fa45716c9461a07f03428754d2bb05a0e6f2943.zip symfony-security-5fa45716c9461a07f03428754d2bb05a0e6f2943.tar.gz symfony-security-5fa45716c9461a07f03428754d2bb05a0e6f2943.tar.bz2 |
Thanks fabbot!
-rw-r--r-- | Guard/AbstractGuardAuthenticator.php | 7 | ||||
-rw-r--r-- | Guard/Firewall/GuardAuthenticationListener.php | 22 | ||||
-rw-r--r-- | Guard/GuardAuthenticatorHandler.php | 31 | ||||
-rw-r--r-- | Guard/GuardAuthenticatorInterface.php | 25 | ||||
-rw-r--r-- | Guard/Provider/GuardAuthenticationProvider.php | 18 | ||||
-rw-r--r-- | Guard/Token/GuardTokenInterface.php | 2 | ||||
-rw-r--r-- | Guard/Token/PreAuthenticationGuardToken.php | 2 | ||||
-rw-r--r-- | Http/EntryPoint/AuthenticationEntryPointInterface.php | 2 |
8 files changed, 60 insertions, 49 deletions
diff --git a/Guard/AbstractGuardAuthenticator.php b/Guard/AbstractGuardAuthenticator.php index 647cb02..95a398b 100644 --- a/Guard/AbstractGuardAuthenticator.php +++ b/Guard/AbstractGuardAuthenticator.php @@ -6,7 +6,7 @@ use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Guard\Token\PostAuthenticationGuardToken; /** - * An optional base class that creates a PostAuthenticationGuardToken for you + * An optional base class that creates a PostAuthenticationGuardToken for you. * * @author Ryan Weaver <weaverryan@gmail.com> */ @@ -14,10 +14,11 @@ abstract class AbstractGuardAuthenticator implements GuardAuthenticatorInterface { /** * Shortcut to create a PostAuthenticationGuardToken for you, if you don't really - * care about which authenticated token you're using + * care about which authenticated token you're using. * * @param UserInterface $user - * @param string $providerKey + * @param string $providerKey + * * @return PostAuthenticationGuardToken */ public function createAuthenticatedToken(UserInterface $user, $providerKey) diff --git a/Guard/Firewall/GuardAuthenticationListener.php b/Guard/Firewall/GuardAuthenticationListener.php index 6a4f09c..5c6de60 100644 --- a/Guard/Firewall/GuardAuthenticationListener.php +++ b/Guard/Firewall/GuardAuthenticationListener.php @@ -16,7 +16,7 @@ use Symfony\Component\Security\Http\Firewall\ListenerInterface; use Symfony\Component\Security\Http\RememberMe\RememberMeServicesInterface; /** - * Authentication listener for the "guard" system + * Authentication listener for the "guard" system. * * @author Ryan Weaver <weaverryan@gmail.com> */ @@ -30,11 +30,11 @@ class GuardAuthenticationListener implements ListenerInterface private $rememberMeServices; /** - * @param GuardAuthenticatorHandler $guardHandler The Guard handler - * @param AuthenticationManagerInterface $authenticationManager An AuthenticationManagerInterface instance - * @param string $providerKey The provider (i.e. firewall) key - * @param GuardAuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationProvider - * @param LoggerInterface $logger A LoggerInterface instance + * @param GuardAuthenticatorHandler $guardHandler The Guard handler + * @param AuthenticationManagerInterface $authenticationManager An AuthenticationManagerInterface instance + * @param string $providerKey The provider (i.e. firewall) key + * @param GuardAuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationProvider + * @param LoggerInterface $logger A LoggerInterface instance */ public function __construct(GuardAuthenticatorHandler $guardHandler, AuthenticationManagerInterface $authenticationManager, $providerKey, $guardAuthenticators, LoggerInterface $logger = null) { @@ -50,7 +50,7 @@ class GuardAuthenticationListener implements ListenerInterface } /** - * Iterates over each authenticator to see if each wants to authenticate the request + * Iterates over each authenticator to see if each wants to authenticate the request. * * @param GetResponseEvent $event */ @@ -147,12 +147,12 @@ class GuardAuthenticationListener implements ListenerInterface /** * Checks to see if remember me is supported in the authenticator and - * on the firewall. If it is, the RememberMeServicesInterface is notified + * on the firewall. If it is, the RememberMeServicesInterface is notified. * * @param GuardAuthenticatorInterface $guardAuthenticator - * @param Request $request - * @param TokenInterface $token - * @param Response $response + * @param Request $request + * @param TokenInterface $token + * @param Response $response */ private function triggerRememberMe(GuardAuthenticatorInterface $guardAuthenticator, Request $request, TokenInterface $token, Response $response = null) { diff --git a/Guard/GuardAuthenticatorHandler.php b/Guard/GuardAuthenticatorHandler.php index e574613..5be7eb5 100644 --- a/Guard/GuardAuthenticatorHandler.php +++ b/Guard/GuardAuthenticatorHandler.php @@ -13,7 +13,7 @@ use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\Component\Security\Http\SecurityEvents; /** - * A utility class that does much of the *work* during the guard authentication process + * A utility class that does much of the *work* during the guard authentication process. * * By having the logic here instead of the listener, more of the process * can be called directly (e.g. for manual authentication) or overridden. @@ -33,10 +33,10 @@ class GuardAuthenticatorHandler } /** - * Authenticates the given token in the system + * Authenticates the given token in the system. * * @param TokenInterface $token - * @param Request $request + * @param Request $request */ public function authenticateWithToken(TokenInterface $token, Request $request) { @@ -49,12 +49,13 @@ class GuardAuthenticatorHandler } /** - * Returns the "on success" response for the given GuardAuthenticator + * Returns the "on success" response for the given GuardAuthenticator. * - * @param TokenInterface $token - * @param Request $request + * @param TokenInterface $token + * @param Request $request * @param GuardAuthenticatorInterface $guardAuthenticator - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key + * * @return null|Response */ public function handleAuthenticationSuccess(TokenInterface $token, Request $request, GuardAuthenticatorInterface $guardAuthenticator, $providerKey) @@ -75,12 +76,13 @@ class GuardAuthenticatorHandler /** * Convenience method for authenticating the user and returning the - * Response *if any* for success + * Response *if any* for success. * - * @param UserInterface $user - * @param Request $request + * @param UserInterface $user + * @param Request $request * @param GuardAuthenticatorInterface $authenticator - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key + * * @return Response|null */ public function authenticateUserAndHandleSuccess(UserInterface $user, Request $request, GuardAuthenticatorInterface $authenticator, $providerKey) @@ -96,11 +98,12 @@ class GuardAuthenticatorHandler /** * Handles an authentication failure and returns the Response for the - * GuardAuthenticator + * GuardAuthenticator. * - * @param AuthenticationException $authenticationException - * @param Request $request + * @param AuthenticationException $authenticationException + * @param Request $request * @param GuardAuthenticatorInterface $guardAuthenticator + * * @return null|Response */ public function handleAuthenticationFailure(AuthenticationException $authenticationException, Request $request, GuardAuthenticatorInterface $guardAuthenticator) diff --git a/Guard/GuardAuthenticatorInterface.php b/Guard/GuardAuthenticatorInterface.php index f6405e9..0b4306c 100644 --- a/Guard/GuardAuthenticatorInterface.php +++ b/Guard/GuardAuthenticatorInterface.php @@ -12,7 +12,7 @@ use Symfony\Component\Security\Guard\Token\GuardTokenInterface; use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface; /** - * The interface for all "guard" authenticators + * The interface for all "guard" authenticators. * * The methods on this interface are called throughout the guard authentication * process to give you the power to control most parts of the process from @@ -41,39 +41,44 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * return array('api_key' => $request->headers->get('X-API-TOKEN')); * * @param Request $request + * * @return mixed|null */ public function getCredentialsFromRequest(Request $request); /** * Return a UserInterface object based on the credentials OR throw - * an AuthenticationException + * an AuthenticationException. * * The *credentials* are the return value from getCredentialsFromRequest() * - * @param mixed $credentials + * @param mixed $credentials * @param UserProviderInterface $userProvider + * * @throws AuthenticationException + * * @return UserInterface */ public function authenticate($credentials, UserProviderInterface $userProvider); /** - * Create an authenticated token for the given user + * Create an authenticated token for the given user. * * If you don't care about which token class is used or don't really * understand what a "token" is, you can skip this method by extending * the AbstractGuardAuthenticator class from your authenticator. * * @see AbstractGuardAuthenticator + * * @param UserInterface $user - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key + * * @return GuardTokenInterface */ public function createAuthenticatedToken(UserInterface $user, $providerKey); /** - * Called when authentication executed, but failed (e.g. wrong username password) + * Called when authentication executed, but failed (e.g. wrong username password). * * This should return the Response sent back to the user, like a * RedirectResponse to the login page or a 403 response. @@ -81,8 +86,9 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * If you return null, the request will continue, but the user will * not be authenticated. This is probably not what you want to do. * - * @param Request $request + * @param Request $request * @param AuthenticationException $exception + * * @return Response|null */ public function onAuthenticationFailure(Request $request, AuthenticationException $exception); @@ -96,9 +102,10 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * If you return null, the current request will continue, and the user * will be authenticated. This makes sense, for example, with an API. * - * @param Request $request + * @param Request $request * @param TokenInterface $token - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key + * * @return Response|null */ public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey); diff --git a/Guard/Provider/GuardAuthenticationProvider.php b/Guard/Provider/GuardAuthenticationProvider.php index 524d7fe..c21af4c 100644 --- a/Guard/Provider/GuardAuthenticationProvider.php +++ b/Guard/Provider/GuardAuthenticationProvider.php @@ -4,7 +4,6 @@ namespace Symfony\Component\Security\Guard\Provider; use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface; use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken; -use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Guard\GuardAuthenticatorInterface; use Symfony\Component\Security\Guard\Token\GuardTokenInterface; use Symfony\Component\Security\Guard\Token\PreAuthenticationGuardToken; @@ -15,7 +14,7 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; /** * Responsible for accepting the PreAuthenticationGuardToken and calling - * the correct authenticator to retrieve the authenticated token + * the correct authenticator to retrieve the authenticated token. * * @author Ryan Weaver <weaverryan@gmail.com> */ @@ -30,10 +29,10 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface private $userChecker; /** - * @param GuardAuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationListener - * @param UserProviderInterface $userProvider The user provider - * @param string $providerKey The provider (i.e. firewall) key - * @param UserCheckerInterface $userChecker + * @param GuardAuthenticatorInterface[] $guardAuthenticators The authenticators, with keys that match what's passed to GuardAuthenticationListener + * @param UserProviderInterface $userProvider The user provider + * @param string $providerKey The provider (i.e. firewall) key + * @param UserCheckerInterface $userChecker */ public function __construct(array $guardAuthenticators, UserProviderInterface $userProvider, $providerKey, UserCheckerInterface $userChecker) { @@ -44,9 +43,10 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface } /** - * Finds the correct authenticator for the token and calls it + * Finds the correct authenticator for the token and calls it. * * @param GuardTokenInterface $token + * * @return TokenInterface */ public function authenticate(TokenInterface $token) @@ -66,7 +66,7 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface */ // this should never happen - but technically, the token is - // authenticated... so it could jsut be returned + // authenticated... so it could just be returned if ($token->isAuthenticated()) { return $token; } @@ -106,7 +106,7 @@ class GuardAuthenticationProvider implements AuthenticationProviderInterface } // check the AdvancedUserInterface methods! - $this->userChecker->checkPreAuth($user);; + $this->userChecker->checkPreAuth($user); $this->userChecker->checkPostAuth($user); // turn the UserInterface into a TokenInterface diff --git a/Guard/Token/GuardTokenInterface.php b/Guard/Token/GuardTokenInterface.php index f4afb70..de3d086 100644 --- a/Guard/Token/GuardTokenInterface.php +++ b/Guard/Token/GuardTokenInterface.php @@ -3,7 +3,7 @@ namespace Symfony\Component\Security\Guard\Token; /** - * An empty interface that both guard tokens implement + * An empty interface that both guard tokens implement. * * This interface is used by the GuardAuthenticationProvider to know * that a token belongs to its system. diff --git a/Guard/Token/PreAuthenticationGuardToken.php b/Guard/Token/PreAuthenticationGuardToken.php index 1bfe639..8950f93 100644 --- a/Guard/Token/PreAuthenticationGuardToken.php +++ b/Guard/Token/PreAuthenticationGuardToken.php @@ -5,7 +5,7 @@ namespace Symfony\Component\Security\Guard\Token; use Symfony\Component\Security\Core\Authentication\Token\AbstractToken; /** - * The token used by the guard auth system before authentication + * The token used by the guard auth system before authentication. * * The GuardAuthenticationListener creates this, which is then consumed * immediately by the GuardAuthenticationProvider. If authentication is diff --git a/Http/EntryPoint/AuthenticationEntryPointInterface.php b/Http/EntryPoint/AuthenticationEntryPointInterface.php index 2aa7a03..df777f6 100644 --- a/Http/EntryPoint/AuthenticationEntryPointInterface.php +++ b/Http/EntryPoint/AuthenticationEntryPointInterface.php @@ -24,7 +24,7 @@ use Symfony\Component\HttpFoundation\Response; interface AuthenticationEntryPointInterface { /** - * Returns a response that directs the user to authenticate + * Returns a response that directs the user to authenticate. * * This is called when an anonymous request accesses a resource that * requires authentication. The job of this method is to return some |