Updated entity class names

This commit is contained in:
Alex Bilbie 2014-05-02 15:14:12 +01:00
parent 6e5327a0e2
commit 782f43c73a
12 changed files with 66 additions and 59 deletions

View File

@ -11,11 +11,11 @@
namespace League\OAuth2\Server\Storage; namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Entity\AccessToken; use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\AbstractToken; use League\OAuth2\Server\Entity\AbstractTokenEntity;
use League\OAuth2\Server\Entity\RefreshToken; use League\OAuth2\Server\Entity\RefreshTokenEntity;
use League\OAuth2\Server\Entity\AuthCode; use League\OAuth2\Server\Entity\AuthCodeEntity;
use League\OAuth2\Server\Entity\Scope; use League\OAuth2\Server\Entity\ScopeEntity;
/** /**
* Access token interface * Access token interface
@ -23,25 +23,25 @@ use League\OAuth2\Server\Entity\Scope;
interface AccessTokenInterface interface AccessTokenInterface
{ {
/** /**
* Get an instance of Entity\AccessToken * Get an instance of Entity\AccessTokenEntity
* @param string $token The access token * @param string $token The access token
* @return \League\OAuth2\Server\Entity\AccessToken * @return \League\OAuth2\Server\Entity\AccessTokenEntity
*/ */
public function get($token); public function get($token);
/** /**
* Get the access token associated with an access token * Get the access token associated with an access token
* @param \League\OAuth2\Server\Entity\RefreshToken $refreshToken * @param \League\OAuth2\Server\Entity\RefreshTokenEntity $refreshToken
* @return \League\OAuth2\Server\Entity\AccessToken * @return \League\OAuth2\Server\Entity\AccessTokenEntity
*/ */
public function getByRefreshToken(RefreshToken $refreshToken); public function getByRefreshToken(RefreshTokenEntity $refreshToken);
/** /**
* Get the scopes for an access token * Get the scopes for an access token
* @param \League\OAuth2\Server\Entity\AbstractToken $token The access token * @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token
* @return array Array of \League\OAuth2\Server\Entity\Scope * @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
*/ */
public function getScopes(AbstractToken $token); public function getScopes(AbstractTokenEntity $token);
/** /**
* Creates a new access token * Creates a new access token
@ -54,16 +54,16 @@ interface AccessTokenInterface
/** /**
* Associate a scope with an acess token * Associate a scope with an acess token
* @param \League\OAuth2\Server\Entity\AbstractToken $token The access token * @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token
* @param \League\OAuth2\Server\Entity\Scope $scope The scope * @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
* @return void * @return void
*/ */
public function associateScope(AbstractToken $token, Scope $scope); public function associateScope(AbstractTokenEntity $token, ScopeEntity $scope);
/** /**
* Delete an access token * Delete an access token
* @param \League\OAuth2\Server\Entity\AbstractToken $token The access token to delete * @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token to delete
* @return void * @return void
*/ */
public function delete(AbstractToken $token); public function delete(AbstractTokenEntity $token);
} }

View File

@ -19,7 +19,7 @@ interface AuthCodeInterface
/** /**
* Get the auth code * Get the auth code
* @param string $code * @param string $code
* @return \League\OAuth2\Server\Entity\AuthCode * @return \League\OAuth2\Server\Entity\AuthCodeEntity
*/ */
public function get($code); public function get($code);
} }

View File

@ -11,7 +11,7 @@
namespace League\OAuth2\Server\Storage; namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Entity\Session; use League\OAuth2\Server\Entity\SessionEntity;
/** /**
* Client storage interface * Client storage interface
@ -24,14 +24,14 @@ interface ClientInterface
* @param string $clientSecret The client's secret (default = "null") * @param string $clientSecret The client's secret (default = "null")
* @param string $redirectUri The client's redirect URI (default = "null") * @param string $redirectUri The client's redirect URI (default = "null")
* @param string $grantType The grant type used in the request (default = "null") * @param string $grantType The grant type used in the request (default = "null")
* @return League\OAuth2\Server\Entity\Client * @return League\OAuth2\Server\Entity\ClientEntity
*/ */
public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null); public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null);
/** /**
* Get the client associated with a session * Get the client associated with a session
* @param \League\OAuth2\Server\Entity\Session $session The session * @param \League\OAuth2\Server\Entity\SessionEntity $session The session
* @return \League\OAuth2\Server\Entity\Client * @return \League\OAuth2\Server\Entity\ClientEntity
*/ */
public function getBySession(Session $session); public function getBySession(SessionEntity $session);
} }

View File

@ -11,15 +11,17 @@
namespace League\OAuth2\Server\Storage; namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Entity\RefreshTokenEntity;
/** /**
* Refresh token interface * Refresh token interface
*/ */
interface RefreshTokenInterface interface RefreshTokenInterface
{ {
/** /**
* Return a new instance of \League\OAuth2\Server\Entity\RefreshToken * Return a new instance of \League\OAuth2\Server\Entity\RefreshTokenEntity
* @param string $token * @param string $token
* @return \League\OAuth2\Server\Entity\RefreshToken * @return \League\OAuth2\Server\Entity\RefreshTokenEntity
*/ */
public function get($token); public function get($token);
@ -28,14 +30,14 @@ interface RefreshTokenInterface
* @param string $token * @param string $token
* @param integer $expireTime * @param integer $expireTime
* @param string $accessToken * @param string $accessToken
* @return \League\OAuth2\Server\Entity\RefreshToken * @return \League\OAuth2\Server\Entity\RefreshTokenEntity
*/ */
public function create($token, $expireTime, $accessToken); public function create($token, $expireTime, $accessToken);
/** /**
* Delete the refresh token * Delete the refresh token
* @param string $token * @param \League\OAuth2\Server\Entity\RefreshTokenEntity $token
* @return void * @return void
*/ */
public function delete($token); public function delete(RefreshTokenEntity $token);
} }

View File

@ -27,7 +27,7 @@ interface ScopeInterface
* *
* @param string $scope The scope * @param string $scope The scope
* @param string $grantType The grant type used in the request (default = "null") * @param string $grantType The grant type used in the request (default = "null")
* @return bool|array If the scope doesn't exist return false * @return \League\OAuth2\Server\Entity\ScopeEntity
*/ */
public function get($scope, $grantType = null); public function get($scope, $grantType = null);
} }

View File

@ -11,6 +11,11 @@
namespace League\OAuth2\Server\Storage; namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\AuthCodeEntity;
use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Entity\ScopeEntity;
/** /**
* Session storage interface * Session storage interface
*/ */
@ -19,30 +24,30 @@ interface SessionInterface
/** /**
* Get a session from it's identifier * Get a session from it's identifier
* @param string $sessionId * @param string $sessionId
* @return \League\OAuth2\Server\Entity\Session * @return \League\OAuth2\Server\Entity\SessionEntity
*/ */
public function get($sessionId); public function get($sessionId);
/** /**
* Get a session from an access token * Get a session from an access token
* @param \League\OAuth2\Server\Entity\AccessToken $accessToken The access token * @param \League\OAuth2\Server\Entity\AccessTokenEntity $accessToken The access token
* @return \League\OAuth2\Server\Entity\Session * @return \League\OAuth2\Server\Entity\SessionEntity
*/ */
public function getByAccessToken($accessToken); public function getByAccessToken(AccessTokenEntity $accessToken);
/** /**
* Get a session from an auth code * Get a session from an auth code
* @param \League\OAuth2\Server\Entity\AuthCode $authCode The auth code * @param \League\OAuth2\Server\Entity\AuthCodeEntity $authCode The auth code
* @return \League\OAuth2\Server\Entity\Session * @return \League\OAuth2\Server\Entity\SessionEntity
*/ */
public function getByAuthCode($authCode); public function getByAuthCode(AuthCodeEntity $authCode);
/** /**
* Get a session's scopes * Get a session's scopes
* @param integer $sessionId * @param \League\OAuth2\Server\Entity\SessionEntity
* @return array Array of \League\OAuth2\Server\Entity\Scope * @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
*/ */
public function getScopes($sessionId); public function getScopes(SessionEntity $session);
/** /**
* Create a new session * Create a new session
@ -56,9 +61,9 @@ interface SessionInterface
/** /**
* Associate a scope with a session * Associate a scope with a session
* @param integer $sessionId * @param \League\OAuth2\Server\Entity\SessionEntity $scope The scope
* @param string $scopeId The scopes ID might be an integer or string * @param \League\OAuth2\Server\Entity\ScopeEntity $scope The scope
* @return void * @return void
*/ */
public function associateScope($sessionId, $scopeId); public function associateScope(SessionEntity $session, ScopeEntity $scope);
} }

View File

@ -3,7 +3,7 @@
namespace LeagueTests\Grant; namespace LeagueTests\Grant;
use League\OAuth2\Server\Grant; use League\OAuth2\Server\Grant;
use League\OAuth2\Server\Entity\Scope; use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\AuthorizationServer;
use League\OAuth2\Server\Exception\InvalidRequestException; use League\OAuth2\Server\Exception\InvalidRequestException;
use LeagueTests\Stubs\StubAbstractGrant; use LeagueTests\Stubs\StubAbstractGrant;

View File

@ -4,9 +4,9 @@ namespace LeagueTests\Grant;
use League\OAuth2\Server\Grant\AuthCode; use League\OAuth2\Server\Grant\AuthCode;
use League\OAuth2\Server\Grant\RefreshToken; use League\OAuth2\Server\Grant\RefreshToken;
use League\OAuth2\Server\Entity\Scope; use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Entity\Client; use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\Session; use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Entity\AuthCode as AC; use League\OAuth2\Server\Entity\AuthCode as AC;
use League\OAuth2\Server\AuthorizationServer as Authorization; use League\OAuth2\Server\AuthorizationServer as Authorization;
use League\OAuth2\Server\Exception\InvalidRequestException; use League\OAuth2\Server\Exception\InvalidRequestException;

View File

@ -3,8 +3,8 @@
namespace LeagueTests\Grant; namespace LeagueTests\Grant;
use League\OAuth2\Server\Grant\ClientCredentials; use League\OAuth2\Server\Grant\ClientCredentials;
use League\OAuth2\Server\Entity\Scope; use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Entity\Client; use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\AuthorizationServer as Authorization; use League\OAuth2\Server\AuthorizationServer as Authorization;
use League\OAuth2\Server\Grant\ClientException; use League\OAuth2\Server\Grant\ClientException;
use Mockery as M; use Mockery as M;

View File

@ -4,8 +4,8 @@ namespace LeagueTests\Grant;
use League\OAuth2\Server\Grant\Password; use League\OAuth2\Server\Grant\Password;
use League\OAuth2\Server\Grant\RefreshToken; use League\OAuth2\Server\Grant\RefreshToken;
use League\OAuth2\Server\Entity\Scope; use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Entity\Client; use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\AuthorizationServer;
use Mockery as M; use Mockery as M;

View File

@ -3,10 +3,10 @@
namespace LeagueTests\Grant; namespace LeagueTests\Grant;
use League\OAuth2\Server\Grant\RefreshToken; use League\OAuth2\Server\Grant\RefreshToken;
use League\OAuth2\Server\Entity\Scope; use League\OAuth2\Server\Entity\ScopeEntity;
use League\OAuth2\Server\Entity\Client; use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\AccessToken; use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\Session; use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Entity\RefreshToken as RT; use League\OAuth2\Server\Entity\RefreshToken as RT;
use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\AuthorizationServer;
use Mockery as M; use Mockery as M;

View File

@ -4,10 +4,10 @@ namespace LeagueTests;
use League\OAuth2\Server\ResourceServer; use League\OAuth2\Server\ResourceServer;
use League\OAuth2\Server\Grant\GrantTypeInterface; use League\OAuth2\Server\Grant\GrantTypeInterface;
use League\OAuth2\Server\Entity\AccessToken; use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\Session; use League\OAuth2\Server\Entity\SessionEntity;
use League\OAuth2\Server\Entity\Client; use League\OAuth2\Server\Entity\ClientEntity;
use League\OAuth2\Server\Entity\Scope; use League\OAuth2\Server\Entity\ScopeEntity;
use \Mockery as M; use \Mockery as M;
class ResourceServerTest extends \PHPUnit_Framework_TestCase class ResourceServerTest extends \PHPUnit_Framework_TestCase