Updated AuthCodeRepositoryInterface

This commit is contained in:
Alex Bilbie 2015-04-05 21:56:42 +01:00
parent be14b3a2df
commit d468cbf600
2 changed files with 10 additions and 28 deletions

View File

@ -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;
}
}
}

View File

@ -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);
}