Renamed storage to repository

This commit is contained in:
Alex Bilbie
2015-02-22 19:44:26 +00:00
parent 7da7484008
commit cc7596f3b3
9 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<?php
/**
* OAuth 2.0 abstract storage
*
* @package league/oauth2-server
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
* @link https://github.com/thephpleague/oauth2-server
*/
namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\AbstractServer;
/**
* Abstract storage class
*/
abstract class AbstractStorage implements StorageInterface
{
/**
* Server
*
* @var \League\OAuth2\Server\AbstractServer $server
*/
protected $server;
/**
* Set the server
*
* @param \League\OAuth2\Server\AbstractServer $server
*
* @return self
*/
public function setServer(AbstractServer $server)
{
$this->server = $server;
return $this;
}
/**
* Return the server
*
* @return \League\OAuth2\Server\AbstractServer
*/
protected function getServer()
{
return $this->server;
}
}

View File

@@ -0,0 +1,69 @@
<?php
/**
* OAuth 2.0 Access token storage interface
*
* @package league/oauth2-server
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
* @link https://github.com/thephpleague/oauth2-server
*/
namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\ScopeEntity;
/**
* Access token interface
*/
interface AccessTokenInterface extends StorageInterface
{
/**
* Get an instance of Entity\AccessTokenEntity
*
* @param string $token The access token
*
* @return \League\OAuth2\Server\Entity\AccessTokenEntity
*/
public function get($token);
/**
* Get the scopes for an access token
*
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token
*
* @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
*/
public function getScopes(AccessTokenEntity $token);
/**
* Creates a new access token
*
* @param string $token The access token
* @param integer $expireTime The expire time expressed as a unix timestamp
* @param string|integer $sessionId The session ID
*
* @return void
*/
public function create($token, $expireTime, $sessionId);
/**
* Associate a scope with an acess token
*
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
*
* @return void
*/
public function associateScope(AccessTokenEntity $token, ScopeEntity $scope);
/**
* Delete an access token
*
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token to delete
*
* @return void
*/
public function delete(AccessTokenEntity $token);
}

View File

@@ -0,0 +1,70 @@
<?php
/**
* OAuth 2.0 Auth code storage interface
*
* @package league/oauth2-server
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
* @link https://github.com/thephpleague/oauth2-server
*/
namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Entity\AuthCodeEntity;
use League\OAuth2\Server\Entity\ScopeEntity;
/**
* Auth code storage interface
*/
interface AuthCodeInterface extends StorageInterface
{
/**
* Get the auth code
*
* @param string $code
*
* @return \League\OAuth2\Server\Entity\AuthCodeEntity
*/
public function get($code);
/**
* Create an auth code.
*
* @param string $token The token ID
* @param integer $expireTime Token expire time
* @param integer $sessionId Session identifier
* @param string $redirectUri Client redirect uri
*
* @return void
*/
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
*/
public function delete(AuthCodeEntity $token);
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* OAuth 2.0 Client storage interface
*
* @package league/oauth2-server
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
* @link https://github.com/thephpleague/oauth2-server
*/
namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Entity\SessionEntity;
/**
* Client storage interface
*/
interface ClientInterface extends StorageInterface
{
/**
* Validate a client
*
* @param string $clientId The client's ID
* @param string $clientSecret The client's secret (default = "null")
* @param string $redirectUri The client's redirect URI (default = "null")
* @param string $grantType The grant type used (default = "null")
*
* @return \League\OAuth2\Server\Entity\ClientEntity
*/
public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null);
/**
* Get the client associated with a session
*
* @param \League\OAuth2\Server\Entity\SessionEntity $session The session
*
* @return \League\OAuth2\Server\Entity\ClientEntity
*/
public function getBySession(SessionEntity $session);
}

View File

@@ -0,0 +1,34 @@
<?php
/**
* OAuth 2.0 MAC Token Interface
*
* @package league/oauth2-server
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
* @link https://github.com/thephpleague/oauth2-server
*/
namespace League\OAuth2\Server\Storage;
/**
* MacTokenInterface
*/
interface MacTokenInterface extends StorageInterface
{
/**
* Create a MAC key linked to an access token
* @param string $macKey
* @param string $accessToken
* @return void
*/
public function create($macKey, $accessToken);
/**
* Get a MAC key by access token
* @param string $accessToken
* @return string
*/
public function getByAccessToken($accessToken);
}

View File

@@ -0,0 +1,49 @@
<?php
/**
* OAuth 2.0 Refresh token storage interface
*
* @package league/oauth2-server
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
* @link https://github.com/thephpleague/oauth2-server
*/
namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Entity\RefreshTokenEntity;
/**
* Refresh token interface
*/
interface RefreshTokenInterface extends StorageInterface
{
/**
* Return a new instance of \League\OAuth2\Server\Entity\RefreshTokenEntity
*
* @param string $token
*
* @return \League\OAuth2\Server\Entity\RefreshTokenEntity
*/
public function get($token);
/**
* Create a new refresh token_name
*
* @param string $token
* @param integer $expireTime
* @param string $accessToken
*
* @return \League\OAuth2\Server\Entity\RefreshTokenEntity
*/
public function create($token, $expireTime, $accessToken);
/**
* Delete the refresh token
*
* @param \League\OAuth2\Server\Entity\RefreshTokenEntity $token
*
* @return void
*/
public function delete(RefreshTokenEntity $token);
}

View File

@@ -0,0 +1,29 @@
<?php
/**
* OAuth 2.0 Scope storage interface
*
* @package league/oauth2-server
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
* @link https://github.com/thephpleague/oauth2-server
*/
namespace League\OAuth2\Server\Storage;
/**
* Scope interface
*/
interface ScopeInterface extends StorageInterface
{
/**
* Return information about a scope
*
* @param string $scope The scope
* @param string $grantType The grant type used in the request (default = "null")
* @param string $clientId The client sending the request (default = "null")
*
* @return \League\OAuth2\Server\Entity\ScopeEntity
*/
public function get($scope, $grantType = null, $clientId = null);
}

View File

@@ -0,0 +1,72 @@
<?php
/**
* OAuth 2.0 Session storage interface
*
* @package league/oauth2-server
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
* @link https://github.com/thephpleague/oauth2-server
*/
namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\AuthCodeEntity;
use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Entity\SessionEntity;
/**
* Session storage interface
*/
interface SessionInterface extends StorageInterface
{
/**
* Get a session from an access token
*
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken The access token
*
* @return \League\OAuth2\Server\Entity\SessionEntity
*/
public function getByAccessToken(AccessTokenEntity $accessToken);
/**
* Get a session from an auth code
*
* @param \League\OAuth2\Server\Entity\AuthCodeEntity $authCode The auth code
*
* @return \League\OAuth2\Server\Entity\SessionEntity
*/
public function getByAuthCode(AuthCodeEntity $authCode);
/**
* Get a session's scopes
*
* @param \League\OAuth2\Server\Entity\SessionEntity
*
* @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
*/
public function getScopes(SessionEntity $session);
/**
* Create a new session
*
* @param string $ownerType Session owner's type (user, client)
* @param string $ownerId Session owner's ID
* @param string $clientId Client ID
* @param string $clientRedirectUri Client redirect URI (default = null)
*
* @return integer The session's ID
*/
public function create($ownerType, $ownerId, $clientId, $clientRedirectUri = null);
/**
* Associate a scope with a session
*
* @param \League\OAuth2\Server\Entity\SessionEntity $session The session
* @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
*
* @return void
*/
public function associateScope(SessionEntity $session, ScopeEntity $scope);
}

View File

@@ -0,0 +1,27 @@
<?php
/**
* OAuth 2.0 Storage interface
*
* @package league/oauth2-server
* @author Alex Bilbie <hello@alexbilbie.com>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
* @link https://github.com/thephpleague/oauth2-server
*/
namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\AbstractServer;
/**
* Storage interface
*/
interface StorageInterface
{
/**
* Set the server
*
* @param \League\OAuth2\Server\AbstractServer $server
*/
public function setServer(AbstractServer $server);
}