Client is not required here because of finalizeScopes method

This commit is contained in:
Alex Bilbie 2016-04-10 13:53:16 +01:00
parent 4c0c10ae98
commit a0c4900ee7
7 changed files with 5 additions and 9 deletions

View File

@ -194,7 +194,6 @@ abstract class AbstractGrant implements GrantTypeInterface
* Validate scopes in the request. * Validate scopes in the request.
* *
* @param string $scopes * @param string $scopes
* @param \League\OAuth2\Server\Entities\ClientEntityInterface $client
* @param string $redirectUri * @param string $redirectUri
* *
* @throws \League\OAuth2\Server\Exception\OAuthServerException * @throws \League\OAuth2\Server\Exception\OAuthServerException
@ -203,7 +202,6 @@ abstract class AbstractGrant implements GrantTypeInterface
*/ */
public function validateScopes( public function validateScopes(
$scopes, $scopes,
ClientEntityInterface $client,
$redirectUri = null $redirectUri = null
) { ) {
$scopesList = array_filter( $scopesList = array_filter(

View File

@ -186,7 +186,6 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
$scopes = $this->validateScopes( $scopes = $this->validateScopes(
$this->getQueryStringParameter('scope', $request), $this->getQueryStringParameter('scope', $request),
$client,
$client->getRedirectUri() $client->getRedirectUri()
); );

View File

@ -28,7 +28,7 @@ class ClientCredentialsGrant extends AbstractGrant
) { ) {
// Validate request // Validate request
$client = $this->validateClient($request); $client = $this->validateClient($request);
$scopes = $this->validateScopes($this->getRequestParameter('scope', $request), $client); $scopes = $this->validateScopes($this->getRequestParameter('scope', $request));
// Finalize the requested scopes // Finalize the requested scopes
$scopes = $this->scopeRepository->finalizeScopes($scopes, $this->getIdentifier(), $client); $scopes = $this->scopeRepository->finalizeScopes($scopes, $this->getIdentifier(), $client);

View File

@ -80,7 +80,6 @@ class ImplicitGrant extends AbstractAuthorizeGrant
$scopes = $this->validateScopes( $scopes = $this->validateScopes(
$this->getQueryStringParameter('scope', $request), $this->getQueryStringParameter('scope', $request),
$client,
$client->getRedirectUri() $client->getRedirectUri()
); );

View File

@ -48,7 +48,7 @@ class PasswordGrant extends AbstractGrant
) { ) {
// Validate request // Validate request
$client = $this->validateClient($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); $user = $this->validateUser($request, $client);
// Finalize the requested scopes // Finalize the requested scopes

View File

@ -42,7 +42,7 @@ class RefreshTokenGrant extends AbstractGrant
// Validate request // Validate request
$client = $this->validateClient($request); $client = $this->validateClient($request);
$oldRefreshToken = $this->validateOldRefreshToken($request, $client->getIdentifier()); $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 no new scopes are requested then give the access token the original session scopes
if (count($scopes) === 0) { if (count($scopes) === 0) {

View File

@ -374,7 +374,7 @@ class AbstractGrantTest extends \PHPUnit_Framework_TestCase
$grantMock = $this->getMockForAbstractClass(AbstractGrant::class); $grantMock = $this->getMockForAbstractClass(AbstractGrant::class);
$grantMock->setScopeRepository($scopeRepositoryMock); $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 = $this->getMockForAbstractClass(AbstractGrant::class);
$grantMock->setScopeRepository($scopeRepositoryMock); $grantMock->setScopeRepository($scopeRepositoryMock);
$grantMock->validateScopes('basic ', new ClientEntity()); $grantMock->validateScopes('basic ');
} }
public function testGenerateUniqueIdentifier() public function testGenerateUniqueIdentifier()