From a0c4900ee7b95a8de2453154be083cfe5ca2a159 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 10 Apr 2016 13:53:16 +0100 Subject: [PATCH] Client is not required here because of finalizeScopes method --- src/Grant/AbstractGrant.php | 2 -- src/Grant/AuthCodeGrant.php | 1 - src/Grant/ClientCredentialsGrant.php | 2 +- src/Grant/ImplicitGrant.php | 1 - src/Grant/PasswordGrant.php | 2 +- src/Grant/RefreshTokenGrant.php | 2 +- tests/Grant/AbstractGrantTest.php | 4 ++-- 7 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Grant/AbstractGrant.php b/src/Grant/AbstractGrant.php index e2caed89..fd7b1e48 100644 --- a/src/Grant/AbstractGrant.php +++ b/src/Grant/AbstractGrant.php @@ -194,7 +194,6 @@ abstract class AbstractGrant implements GrantTypeInterface * Validate scopes in the request. * * @param string $scopes - * @param \League\OAuth2\Server\Entities\ClientEntityInterface $client * @param string $redirectUri * * @throws \League\OAuth2\Server\Exception\OAuthServerException @@ -203,7 +202,6 @@ abstract class AbstractGrant implements GrantTypeInterface */ public function validateScopes( $scopes, - ClientEntityInterface $client, $redirectUri = null ) { $scopesList = array_filter( diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index a4cf5dd1..c8b496a4 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -186,7 +186,6 @@ class AuthCodeGrant extends AbstractAuthorizeGrant $scopes = $this->validateScopes( $this->getQueryStringParameter('scope', $request), - $client, $client->getRedirectUri() ); diff --git a/src/Grant/ClientCredentialsGrant.php b/src/Grant/ClientCredentialsGrant.php index 49493372..c8ff2d52 100644 --- a/src/Grant/ClientCredentialsGrant.php +++ b/src/Grant/ClientCredentialsGrant.php @@ -28,7 +28,7 @@ class ClientCredentialsGrant extends AbstractGrant ) { // Validate request $client = $this->validateClient($request); - $scopes = $this->validateScopes($this->getRequestParameter('scope', $request), $client); + $scopes = $this->validateScopes($this->getRequestParameter('scope', $request)); // Finalize the requested scopes $scopes = $this->scopeRepository->finalizeScopes($scopes, $this->getIdentifier(), $client); diff --git a/src/Grant/ImplicitGrant.php b/src/Grant/ImplicitGrant.php index 497542d5..92e5b84b 100644 --- a/src/Grant/ImplicitGrant.php +++ b/src/Grant/ImplicitGrant.php @@ -80,7 +80,6 @@ class ImplicitGrant extends AbstractAuthorizeGrant $scopes = $this->validateScopes( $this->getQueryStringParameter('scope', $request), - $client, $client->getRedirectUri() ); diff --git a/src/Grant/PasswordGrant.php b/src/Grant/PasswordGrant.php index 29262306..6d98115d 100644 --- a/src/Grant/PasswordGrant.php +++ b/src/Grant/PasswordGrant.php @@ -48,7 +48,7 @@ class PasswordGrant extends AbstractGrant ) { // Validate request $client = $this->validateClient($request); - $scopes = $this->validateScopes($this->getRequestParameter('scope', $request), $client); + $scopes = $this->validateScopes($this->getRequestParameter('scope', $request)); $user = $this->validateUser($request, $client); // Finalize the requested scopes diff --git a/src/Grant/RefreshTokenGrant.php b/src/Grant/RefreshTokenGrant.php index 43249647..168e9908 100644 --- a/src/Grant/RefreshTokenGrant.php +++ b/src/Grant/RefreshTokenGrant.php @@ -42,7 +42,7 @@ class RefreshTokenGrant extends AbstractGrant // Validate request $client = $this->validateClient($request); $oldRefreshToken = $this->validateOldRefreshToken($request, $client->getIdentifier()); - $scopes = $this->validateScopes($this->getRequestParameter('scope', $request), $client); + $scopes = $this->validateScopes($this->getRequestParameter('scope', $request)); // If no new scopes are requested then give the access token the original session scopes if (count($scopes) === 0) { diff --git a/tests/Grant/AbstractGrantTest.php b/tests/Grant/AbstractGrantTest.php index 27fe44d5..1321654d 100644 --- a/tests/Grant/AbstractGrantTest.php +++ b/tests/Grant/AbstractGrantTest.php @@ -374,7 +374,7 @@ class AbstractGrantTest extends \PHPUnit_Framework_TestCase $grantMock = $this->getMockForAbstractClass(AbstractGrant::class); $grantMock->setScopeRepository($scopeRepositoryMock); - $this->assertEquals([$scope], $grantMock->validateScopes('basic ', new ClientEntity())); + $this->assertEquals([$scope], $grantMock->validateScopes('basic ')); } /** @@ -389,7 +389,7 @@ class AbstractGrantTest extends \PHPUnit_Framework_TestCase $grantMock = $this->getMockForAbstractClass(AbstractGrant::class); $grantMock->setScopeRepository($scopeRepositoryMock); - $grantMock->validateScopes('basic ', new ClientEntity()); + $grantMock->validateScopes('basic '); } public function testGenerateUniqueIdentifier()