mirror of
				https://github.com/elyby/oauth2-server.git
				synced 2025-05-31 14:12:07 +05:30 
			
		
		
		
	Update token types
This commit is contained in:
		@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -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')
 | 
			
		||||
 
 | 
			
		||||
@@ -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');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user