mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 21:19:46 +05:30
Revert "Remove redundant parameters in example" #553
This reverts commit 9a93dca05c
.
This commit is contained in:
parent
cf63403585
commit
db055f790d
@ -43,8 +43,15 @@ class AccessTokenRepository implements AccessTokenRepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getNewToken()
|
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null)
|
||||||
{
|
{
|
||||||
return new AccessTokenEntity();
|
$accessToken = new AccessTokenEntity();
|
||||||
|
$accessToken->setClient($clientEntity);
|
||||||
|
foreach ($scopes as $scope) {
|
||||||
|
$accessToken->addScope($scope);
|
||||||
|
}
|
||||||
|
$accessToken->setUserIdentifier($userIdentifier);
|
||||||
|
|
||||||
|
return $accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ abstract class AbstractGrant implements GrantTypeInterface
|
|||||||
$userIdentifier,
|
$userIdentifier,
|
||||||
array $scopes = []
|
array $scopes = []
|
||||||
) {
|
) {
|
||||||
$accessToken = $this->accessTokenRepository->getNewToken();
|
$accessToken = $this->accessTokenRepository->getNewToken($client, $scopes, $userIdentifier);
|
||||||
$accessToken->setClient($client);
|
$accessToken->setClient($client);
|
||||||
$accessToken->setUserIdentifier($userIdentifier);
|
$accessToken->setUserIdentifier($userIdentifier);
|
||||||
$accessToken->setIdentifier($this->generateUniqueIdentifier());
|
$accessToken->setIdentifier($this->generateUniqueIdentifier());
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
namespace League\OAuth2\Server\Repositories;
|
namespace League\OAuth2\Server\Repositories;
|
||||||
|
|
||||||
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
|
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
|
||||||
|
use League\OAuth2\Server\Entities\ClientEntityInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access token interface.
|
* Access token interface.
|
||||||
@ -19,9 +20,13 @@ interface AccessTokenRepositoryInterface extends RepositoryInterface
|
|||||||
/**
|
/**
|
||||||
* Create a new access token
|
* Create a new access token
|
||||||
*
|
*
|
||||||
|
* @param \League\OAuth2\Server\Entities\ClientEntityInterface $clientEntity
|
||||||
|
* @param \League\OAuth2\Server\Entities\ScopeEntityInterface[] $scopes
|
||||||
|
* @param mixed $userIdentifier
|
||||||
|
*
|
||||||
* @return AccessTokenEntityInterface
|
* @return AccessTokenEntityInterface
|
||||||
*/
|
*/
|
||||||
public function getNewToken();
|
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Persists a new access token to permanent storage.
|
* Persists a new access token to permanent storage.
|
||||||
|
Loading…
Reference in New Issue
Block a user