From 2f971dc77f04b5d70a1c09c917868d4dfa596652 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Thu, 20 Nov 2014 23:54:41 +0000 Subject: [PATCH] Declared all of the methods in AbstractTokenType in TokenTypeInterface as per #255 --- src/Storage/AccessTokenInterface.php | 13 ++++++------ src/TokenType/AbstractTokenType.php | 24 ++++----------------- src/TokenType/TokenTypeInterface.php | 31 ++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 27 deletions(-) diff --git a/src/Storage/AccessTokenInterface.php b/src/Storage/AccessTokenInterface.php index dc98b6d6..d51c5c04 100644 --- a/src/Storage/AccessTokenInterface.php +++ b/src/Storage/AccessTokenInterface.php @@ -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); } diff --git a/src/TokenType/AbstractTokenType.php b/src/TokenType/AbstractTokenType.php index 7a0e0f5a..a89997cf 100644 --- a/src/TokenType/AbstractTokenType.php +++ b/src/TokenType/AbstractTokenType.php @@ -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); } diff --git a/src/TokenType/TokenTypeInterface.php b/src/TokenType/TokenTypeInterface.php index c0116ba8..610e9f16 100644 --- a/src/TokenType/TokenTypeInterface.php +++ b/src/TokenType/TokenTypeInterface.php @@ -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); }