Merge pull request #553 from markinjapan/patch-1

Remove redundant parameters in getNewToken()
This commit is contained in:
Alex Bilbie 2016-04-27 20:58:29 +01:00
commit acf262f879
3 changed files with 4 additions and 16 deletions

View File

@ -43,15 +43,8 @@ class AccessTokenRepository implements AccessTokenRepositoryInterface
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null) public function getNewToken()
{ {
$accessToken = new AccessTokenEntity(); return new AccessTokenEntity();
$accessToken->setClient($clientEntity);
foreach ($scopes as $scope) {
$accessToken->addScope($scope);
}
$accessToken->setUserIdentifier($userIdentifier);
return $accessToken;
} }
} }

View File

@ -300,7 +300,7 @@ abstract class AbstractGrant implements GrantTypeInterface
$userIdentifier, $userIdentifier,
array $scopes = [] array $scopes = []
) { ) {
$accessToken = $this->accessTokenRepository->getNewToken($client, $scopes, $userIdentifier); $accessToken = $this->accessTokenRepository->getNewToken();
$accessToken->setClient($client); $accessToken->setClient($client);
$accessToken->setUserIdentifier($userIdentifier); $accessToken->setUserIdentifier($userIdentifier);
$accessToken->setIdentifier($this->generateUniqueIdentifier()); $accessToken->setIdentifier($this->generateUniqueIdentifier());

View File

@ -10,7 +10,6 @@
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.
@ -20,13 +19,9 @@ 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(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null); public function getNewToken();
/** /**
* Persists a new access token to permanent storage. * Persists a new access token to permanent storage.