From d468cbf600454cd53381f7417bf18dc0e8885838 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sun, 5 Apr 2015 21:56:42 +0100 Subject: [PATCH] Updated AuthCodeRepositoryInterface --- src/AbstractServer.php | 4 +++ .../AuthCodeRepositoryInterface.php | 34 ++++--------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/AbstractServer.php b/src/AbstractServer.php index eba3f2be..28b3d23a 100644 --- a/src/AbstractServer.php +++ b/src/AbstractServer.php @@ -16,6 +16,7 @@ use League\Container\ContainerAwareInterface; use League\Container\ContainerAwareTrait; use League\Event\EmitterAwareInterface; use League\Event\EmitterTrait; +use League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface; use League\OAuth2\Server\Repositories\ClientRepositoryInterface; use League\OAuth2\Server\Repositories\RepositoryInterface; use League\OAuth2\Server\Repositories\ScopeRepositoryInterface; @@ -98,6 +99,9 @@ abstract class AbstractServer implements ContainerAwareInterface, EmitterAwareIn case ($repository instanceof UserRepositoryInterface): $this->getContainer()->add('UserRepository', $repository); break; + case ($repository instanceof AuthCodeRepositoryInterface): + $this->getContainer()->add('AuthCodeRepository', $repository); + break; } } } diff --git a/src/Repositories/AuthCodeRepositoryInterface.php b/src/Repositories/AuthCodeRepositoryInterface.php index 1fe0f8b9..734f5305 100644 --- a/src/Repositories/AuthCodeRepositoryInterface.php +++ b/src/Repositories/AuthCodeRepositoryInterface.php @@ -9,22 +9,21 @@ * @link https://github.com/thephpleague/oauth2-server */ -namespace League\OAuth2\Server\Storage; +namespace League\OAuth2\Server\Repositories; -use League\OAuth2\Server\Entity\AuthCodeEntity; -use League\OAuth2\Server\Entity\ScopeEntity; +use League\OAuth2\Server\Entities\Interfaces\AuthCodeEntityInterface; /** * Auth code storage interface */ -interface AuthCodeInterface extends StorageInterface +interface AuthCodeRepositoryInterface extends RepositoryInterface { /** * Get the auth code * * @param string $code * - * @return \League\OAuth2\Server\Entity\AuthCodeEntity + * @return \League\OAuth2\Server\Entities\Interfaces\AuthCodeEntityInterface */ public function get($code); @@ -40,31 +39,10 @@ interface AuthCodeInterface extends StorageInterface */ public function create($token, $expireTime, $sessionId, $redirectUri); - /** - * Get the scopes for an access token - * - * @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The auth code - * - * @return array Array of \League\OAuth2\Server\Entity\ScopeEntity - */ - public function getScopes(AuthCodeEntity $token); - - /** - * Associate a scope with an acess token - * - * @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The auth code - * @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope - * - * @return void - */ - public function associateScope(AuthCodeEntity $token, ScopeEntity $scope); - /** * Delete an access token * - * @param \League\OAuth2\Server\Entity\AuthCodeEntity $token The access token to delete - * - * @return void + * @param \League\OAuth2\Server\Entities\Interfaces\AuthCodeEntityInterface $token The access token to delete */ - public function delete(AuthCodeEntity $token); + public function delete(AuthCodeEntityInterface $token); }