Declared all of the methods in AbstractTokenType in TokenTypeInterface as per #255

This commit is contained in:
Alex Bilbie 2014-11-20 23:54:41 +00:00
parent ae7b7e9aa9
commit 2f971dc77f
3 changed files with 41 additions and 27 deletions

View File

@ -11,7 +11,6 @@
namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Entity\AbstractTokenEntity;
use League\OAuth2\Server\Entity\AccessTokenEntity;
use League\OAuth2\Server\Entity\ScopeEntity;
@ -29,10 +28,10 @@ interface AccessTokenInterface extends StorageInterface
/**
* Get the scopes for an access token
* @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token
* @return array Array of \League\OAuth2\Server\Entity\ScopeEntity
*/
public function getScopes(AbstractTokenEntity $token);
public function getScopes(AccessTokenEntity $token);
/**
* Creates a new access token
@ -45,16 +44,16 @@ interface AccessTokenInterface extends StorageInterface
/**
* Associate a scope with an acess token
* @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access 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(AbstractTokenEntity $token, ScopeEntity $scope);
public function associateScope(AccessTokenEntity $token, ScopeEntity $scope);
/**
* Delete an access token
* @param \League\OAuth2\Server\Entity\AbstractTokenEntity $token The access token to delete
* @param \League\OAuth2\Server\Entity\AccessTokenEntity $token The access token to delete
* @return void
*/
public function delete(AbstractTokenEntity $token);
public function delete(AccessTokenEntity $token);
}

View File

@ -13,7 +13,6 @@ namespace League\OAuth2\Server\TokenType;
use League\OAuth2\Server\AbstractServer;
use League\OAuth2\Server\Entity\SessionEntity;
use Symfony\Component\HttpFoundation\Request;
abstract class AbstractTokenType
{
@ -36,9 +35,7 @@ abstract class AbstractTokenType
protected $session;
/**
* Set the server
* @param \League\OAuth2\Server\AbstractServer $server
* @return self
* {@inheritdoc}
*/
public function setServer(AbstractServer $server)
{
@ -48,9 +45,7 @@ abstract class AbstractTokenType
}
/**
* Set the session entity
* @param \League\OAuth2\Server\Entity\SessionEntity $session
* @return self
* {@inheritdoc}
*/
public function setSession(SessionEntity $session)
{
@ -60,9 +55,7 @@ abstract class AbstractTokenType
}
/**
* Set a key/value response pair
* @param string $key
* @param mixed $value
* {@inheritdoc}
*/
public function setParam($key, $value)
{
@ -70,19 +63,10 @@ abstract class AbstractTokenType
}
/**
* Get a key from the response array
* @param string $key
* @return mixed
* {@inheritdoc}
*/
public function getParam($key)
{
return isset($this->response[$key]) ? $this->response[$key] : null;
}
/**
* Determine the access token in the authorization header
* @param \Symfony\Component\HttpFoundation\Request $request
* @return string
*/
abstract public function determineAccessTokenInHeader(Request $request);
}

View File

@ -11,6 +11,9 @@
namespace League\OAuth2\Server\TokenType;
use League\OAuth2\Server\AbstractServer;
use Symfony\Component\HttpFoundation\Request;
interface TokenTypeInterface
{
/**
@ -18,4 +21,32 @@ interface TokenTypeInterface
* @return array
*/
public function generateResponse();
/**
* Set the server
* @param \League\OAuth2\Server\AbstractServer $server
* @return self
*/
public function setServer(AbstractServer $server);
/**
* Set a key/value response pair
* @param string $key
* @param mixed $value
*/
public function setParam($key, $value);
/**
* Get a key from the response array
* @param string $key
* @return mixed
*/
public function getParam($key);
/**
* Determine the access token in the authorization header
* @param \Symfony\Component\HttpFoundation\Request $request
* @return string
*/
public function determineAccessTokenInHeader(Request $request);
}