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
|
|
|
*/
|
|
|
|
|
|
|
|
namespace League\OAuth2\Server\Storage;
|
|
|
|
|
2014-05-02 15:14:12 +01:00
|
|
|
use League\OAuth2\Server\Entity\AccessTokenEntity;
|
|
|
|
use League\OAuth2\Server\Entity\AbstractTokenEntity;
|
|
|
|
use League\OAuth2\Server\Entity\RefreshTokenEntity;
|
|
|
|
use League\OAuth2\Server\Entity\ScopeEntity;
|
2014-05-01 14:45:38 +01:00
|
|
|
|
2014-01-08 16:15:29 +00:00
|
|
|
/**
|
|
|
|
* Access token interface
|
|
|
|
*/
|
2013-12-24 17:02:34 +00:00
|
|
|
interface AccessTokenInterface
|
|
|
|
{
|
2014-01-08 16:15:29 +00:00
|
|
|
/**
|
2014-05-02 15:14:12 +01:00
|
|
|
* Get an instance of Entity\AccessTokenEntity
|
2014-05-03 10:53:57 +01:00
|
|
|
* @param string $token The access token
|
2014-05-02 15:14:12 +01:00
|
|
|
* @return \League\OAuth2\Server\Entity\AccessTokenEntity
|
2014-01-08 16:15:29 +00:00
|
|
|
*/
|
2014-01-10 12:30:13 +00:00
|
|
|
public function get($token);
|
|
|
|
|
2014-01-08 16:15:29 +00:00
|
|
|
/**
|
|
|
|
* Get the scopes for an access token
|
2014-05-02 15:14:12 +01:00
|
|
|
* @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token
|
2014-05-03 10:53:57 +01:00
|
|
|
* @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
|
2014-01-08 16:15:29 +00:00
|
|
|
*/
|
2014-05-02 15:14:12 +01:00
|
|
|
public function getScopes(AbstractTokenEntity $token);
|
2013-12-24 17:02:34 +00:00
|
|
|
|
2014-01-08 16:15:29 +00:00
|
|
|
/**
|
|
|
|
* Creates a new access token
|
2014-05-03 10:53:57 +01:00
|
|
|
* @param string $token The access token
|
|
|
|
* @param integer $expireTime The expire time expressed as a unix timestamp
|
|
|
|
* @param string|integer $sessionId The session ID
|
2014-01-16 16:50:16 +00:00
|
|
|
* @return \League\OAuth2\Server\Entity\AccessToken
|
2014-01-08 16:15:29 +00:00
|
|
|
*/
|
2014-01-10 12:30:13 +00:00
|
|
|
public function create($token, $expireTime, $sessionId);
|
2013-12-24 17:02:34 +00:00
|
|
|
|
2014-01-08 16:15:29 +00:00
|
|
|
/**
|
|
|
|
* Associate a scope with an acess token
|
2014-05-02 15:14:12 +01:00
|
|
|
* @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token
|
2014-05-03 10:53:57 +01:00
|
|
|
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
|
2014-01-08 16:15:29 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2014-05-02 15:14:12 +01:00
|
|
|
public function associateScope(AbstractTokenEntity $token, ScopeEntity $scope);
|
2014-01-08 16:15:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete an access token
|
2014-05-02 15:14:12 +01:00
|
|
|
* @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token to delete
|
2014-01-08 16:15:29 +00:00
|
|
|
* @return void
|
|
|
|
*/
|
2014-05-02 15:14:12 +01:00
|
|
|
public function delete(AbstractTokenEntity $token);
|
2013-12-24 17:02:34 +00:00
|
|
|
}
|