Update token types

This commit is contained in:
Alex Bilbie 2014-05-07 17:09:19 +01:00
parent c5ffd05eee
commit 0b047fd8e4
3 changed files with 13 additions and 22 deletions

View File

@ -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;
}

View File

@ -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')

View File

@ -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');
}
}