From eb158cbdb3521220794fad066ad73d5ceecbeddc Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 18 May 2015 08:48:41 -0400 Subject: [PATCH] Updating interface method per suggestion - makes sense to me, Request is redundant --- .../Guard/Firewall/GuardAuthenticationListener.php | 4 ++-- .../Security/Guard/GuardAuthenticatorInterface.php | 4 ++-- .../Tests/Firewall/GuardAuthenticationListenerTest.php | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php index 5c6de607a0..9e2a8868f2 100644 --- a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php +++ b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php @@ -74,11 +74,11 @@ class GuardAuthenticationListener implements ListenerInterface $request = $event->getRequest(); try { if (null !== $this->logger) { - $this->logger->info('Calling getCredentialsFromRequest on guard configurator', array('firewall_key' => $this->providerKey, 'authenticator' => get_class($guardAuthenticator))); + $this->logger->info('Calling getCredentials on guard configurator.', array('firewall_key' => $this->providerKey, 'authenticator' => get_class($guardAuthenticator))); } // allow the authenticator to fetch authentication info from the request - $credentials = $guardAuthenticator->getCredentialsFromRequest($request); + $credentials = $guardAuthenticator->getCredentials($request); // allow null to be returned to skip authentication if (null === $credentials) { diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php index 0b4306c9c0..4b1e4073b9 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php @@ -44,13 +44,13 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * * @return mixed|null */ - public function getCredentialsFromRequest(Request $request); + public function getCredentials(Request $request); /** * Return a UserInterface object based on the credentials OR throw * an AuthenticationException. * - * The *credentials* are the return value from getCredentialsFromRequest() + * The *credentials* are the return value from getCredentials() * * @param mixed $credentials * @param UserProviderInterface $userProvider diff --git a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php index 2de60c1100..ab7829223e 100644 --- a/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Guard/Tests/Firewall/GuardAuthenticationListenerTest.php @@ -38,7 +38,7 @@ class GuardAuthenticationListenerTest extends \PHPUnit_Framework_TestCase $credentials = array('username' => 'weaverryan', 'password' => 'all_your_base'); $authenticator ->expects($this->once()) - ->method('getCredentialsFromRequest') + ->method('getCredentials') ->with($this->equalTo($this->request)) ->will($this->returnValue($credentials)); @@ -87,7 +87,7 @@ class GuardAuthenticationListenerTest extends \PHPUnit_Framework_TestCase $authenticator ->expects($this->once()) - ->method('getCredentialsFromRequest') + ->method('getCredentials') ->with($this->equalTo($this->request)) ->will($this->returnValue(array('username' => 'anything_not_empty'))); @@ -130,7 +130,7 @@ class GuardAuthenticationListenerTest extends \PHPUnit_Framework_TestCase $authException = new AuthenticationException('Get outta here crazy user with a bad password!'); $authenticator ->expects($this->once()) - ->method('getCredentialsFromRequest') + ->method('getCredentials') ->will($this->throwException($authException)); // this is not called @@ -162,11 +162,11 @@ class GuardAuthenticationListenerTest extends \PHPUnit_Framework_TestCase $authenticatorA ->expects($this->once()) - ->method('getCredentialsFromRequest') + ->method('getCredentials') ->will($this->returnValue(null)); $authenticatorB ->expects($this->once()) - ->method('getCredentialsFromRequest') + ->method('getCredentials') ->will($this->returnValue(null)); // this is not called