oauth2-server/src/Repositories/AccessTokenRepositoryInterface.php

65 lines
2.1 KiB
PHP
Raw Normal View History

2013-12-24 17:02:34 +00:00
<?php
/**
* OAuth 2.0 Access token storage interface
*
2014-01-08 16:15:29 +00:00
* @package league/oauth2-server
2013-12-24 17:02:34 +00:00
* @author Alex Bilbie <hello@alexbilbie.com>
2014-03-09 19:34:23 +00:00
* @copyright Copyright (c) Alex Bilbie
2013-12-24 17:02:34 +00:00
* @license http://mit-license.org/
2014-03-09 20:05:38 +00:00
* @link https://github.com/thephpleague/oauth2-server
2013-12-24 17:02:34 +00:00
*/
2015-04-05 17:00:43 +01:00
namespace League\OAuth2\Server\Repositories;
2013-12-24 17:02:34 +00:00
2015-04-05 17:00:43 +01:00
use League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface;
use League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface;
2014-05-01 14:45:38 +01:00
2014-01-08 16:15:29 +00:00
/**
* Access token interface
*/
2015-04-05 17:00:43 +01:00
interface AccessTokenRepositoryInterface extends RepositoryInterface
2013-12-24 17:02:34 +00:00
{
2014-01-08 16:15:29 +00:00
/**
2014-05-02 15:14:12 +01:00
* Get an instance of Entity\AccessTokenEntity
2014-12-10 13:10:35 +00:00
*
* @param string $token The access token identifier
2014-12-10 13:10:35 +00:00
*
2015-04-05 17:00:43 +01:00
* @return \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface
2014-01-08 16:15:29 +00:00
*/
public function getAccessTokenEntityByTokenString($token);
2014-01-10 12:30:13 +00:00
2014-01-08 16:15:29 +00:00
/**
* Get the scopes for an access token
2014-12-10 13:10:35 +00:00
*
2015-04-05 17:00:43 +01:00
* @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $token
2014-12-10 13:10:35 +00:00
*
2015-04-05 17:00:43 +01:00
* @return \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface[]
2014-01-08 16:15:29 +00:00
*/
public function getScopeEntitiesAssociatedWithAccessToken(AccessTokenEntityInterface $token);
2013-12-24 17:02:34 +00:00
2014-01-08 16:15:29 +00:00
/**
2016-01-12 23:02:54 +00:00
* Persists a new access token to permanent storage
2014-12-10 13:10:35 +00:00
*
2015-04-05 17:00:43 +01:00
* @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessTokenEntity
2014-01-08 16:15:29 +00:00
*/
public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity);
2013-12-24 17:02:34 +00:00
2014-01-08 16:15:29 +00:00
/**
2015-04-05 17:00:43 +01:00
* Associate a scope with an access token
2014-12-10 13:10:35 +00:00
*
2015-04-05 17:00:43 +01:00
* @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessTokenEntityInterface
* @param \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface $scope
2014-01-08 16:15:29 +00:00
*/
public function associateScopeWithAccessToken(
AccessTokenEntityInterface $accessTokenEntityInterface,
ScopeEntityInterface $scope
);
2014-01-08 16:15:29 +00:00
/**
* Delete an access token
2014-12-10 13:10:35 +00:00
*
2015-04-05 17:00:43 +01:00
* @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken
2014-01-08 16:15:29 +00:00
*/
public function deleteAccessToken(AccessTokenEntityInterface $accessToken);
2013-12-24 17:02:34 +00:00
}