From 0b047fd8e4255606ae5374323598ac9a475b91cf Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Wed, 7 May 2014 17:09:19 +0100 Subject: [PATCH] Update token types --- src/TokenType/AbstractTokenType.php | 6 +++--- src/TokenType/Bearer.php | 19 ++----------------- src/TokenType/Mac.php | 10 ++++++++-- 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/TokenType/AbstractTokenType.php b/src/TokenType/AbstractTokenType.php index d72181b7..ea0b2549 100644 --- a/src/TokenType/AbstractTokenType.php +++ b/src/TokenType/AbstractTokenType.php @@ -11,7 +11,7 @@ namespace League\OAuth2\Server\TokenType; -abstract class AbstractBearer +abstract class AbstractTokenType { /** * Response array @@ -26,7 +26,7 @@ abstract class AbstractBearer */ public function set($key, $value) { - $this->responsekey[$key] = $value; + $this->response[$key] = $value; } /** @@ -34,7 +34,7 @@ abstract class AbstractBearer * @param string $key * @return mixed */ - private function get($key) + public function get($key) { return isset($this->response[$key]) ? $this->response[$key] : null; } diff --git a/src/TokenType/Bearer.php b/src/TokenType/Bearer.php index 9b1acfaa..ab8350a6 100644 --- a/src/TokenType/Bearer.php +++ b/src/TokenType/Bearer.php @@ -11,30 +11,15 @@ namespace League\OAuth2\Server\TokenType; -class Bearer extends AbstractBearer implements TokenTypeInterface +class Bearer extends AbstractTokenType implements TokenTypeInterface { - protected $response = []; - - /** - * {@inheritdoc} - */ - public function set($key, $value) - { - $this->responsekey[$key] = $value; - } - - private function get($key) - { - return isset($this->response[$key]) ? $this->response[$key] : null; - } - /** * {@inheritdoc} */ public function generateResponse() { $return = [ - 'access_token' => $this->get('refresh_token'), + 'access_token' => $this->get('access_token'), 'token_type' => 'Bearer', 'expires' => $this->get('expires'), 'expires_in' => $this->get('expires_in') diff --git a/src/TokenType/Mac.php b/src/TokenType/Mac.php index b90d31da..6365a248 100644 --- a/src/TokenType/Mac.php +++ b/src/TokenType/Mac.php @@ -11,7 +11,13 @@ namespace League\OAuth2\Server\TokenType; -class Mac extends AbstractBearer implements TokenTypeInterface +class Mac extends AbstractTokenType implements TokenTypeInterface { - + /** + * {@inheritdoc} + */ + public function generateResponse() + { + throw new \RuntimeException('MAC tokens are not currently supported'); + } }