mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-01-07 12:33:53 +05:30
Update token types
This commit is contained in:
parent
c5ffd05eee
commit
0b047fd8e4
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace League\OAuth2\Server\TokenType;
|
namespace League\OAuth2\Server\TokenType;
|
||||||
|
|
||||||
abstract class AbstractBearer
|
abstract class AbstractTokenType
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Response array
|
* Response array
|
||||||
@ -26,7 +26,7 @@ abstract class AbstractBearer
|
|||||||
*/
|
*/
|
||||||
public function set($key, $value)
|
public function set($key, $value)
|
||||||
{
|
{
|
||||||
$this->responsekey[$key] = $value;
|
$this->response[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,7 +34,7 @@ abstract class AbstractBearer
|
|||||||
* @param string $key
|
* @param string $key
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
private function get($key)
|
public function get($key)
|
||||||
{
|
{
|
||||||
return isset($this->response[$key]) ? $this->response[$key] : null;
|
return isset($this->response[$key]) ? $this->response[$key] : null;
|
||||||
}
|
}
|
||||||
|
@ -11,30 +11,15 @@
|
|||||||
|
|
||||||
namespace League\OAuth2\Server\TokenType;
|
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}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function generateResponse()
|
public function generateResponse()
|
||||||
{
|
{
|
||||||
$return = [
|
$return = [
|
||||||
'access_token' => $this->get('refresh_token'),
|
'access_token' => $this->get('access_token'),
|
||||||
'token_type' => 'Bearer',
|
'token_type' => 'Bearer',
|
||||||
'expires' => $this->get('expires'),
|
'expires' => $this->get('expires'),
|
||||||
'expires_in' => $this->get('expires_in')
|
'expires_in' => $this->get('expires_in')
|
||||||
|
@ -11,7 +11,13 @@
|
|||||||
|
|
||||||
namespace League\OAuth2\Server\TokenType;
|
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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user