mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-28 07:50:23 +05:30
Client is not required here because of finalizeScopes method
This commit is contained in:
parent
4c0c10ae98
commit
a0c4900ee7
@ -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(
|
||||||
|
@ -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()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
@ -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()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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) {
|
||||||
|
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user