mirror of
				https://github.com/elyby/oauth2-server.git
				synced 2025-05-31 14:12:07 +05:30 
			
		
		
		
	Merge branch 'feature/no-inject-server' into develop
This commit is contained in:
		@@ -244,6 +244,10 @@ class Authorization
 | 
				
			|||||||
        if (is_null($identifier)) {
 | 
					        if (is_null($identifier)) {
 | 
				
			||||||
            $identifier = $grantType->getIdentifier();
 | 
					            $identifier = $grantType->getIdentifier();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Inject server into grant
 | 
				
			||||||
 | 
					        $grantType->setAuthorizationServer($this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->grantTypes[$identifier] = $grantType;
 | 
					        $this->grantTypes[$identifier] = $grantType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ( ! is_null($grantType->getResponseType())) {
 | 
					        if ( ! is_null($grantType->getResponseType())) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,16 +56,6 @@ class AuthCode implements GrantTypeInterface {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    protected $authTokenTTL = 600;
 | 
					    protected $authTokenTTL = 600;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Constructor
 | 
					 | 
				
			||||||
     * @param Authorization $authServer Authorization server instance
 | 
					 | 
				
			||||||
     * @return void
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public function __construct(Authorization $authServer)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->authServer = $authServer;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Override the default access token expire time
 | 
					     * Override the default access token expire time
 | 
				
			||||||
     * @param int $authTokenTTL
 | 
					     * @param int $authTokenTTL
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,16 +50,6 @@ class ClientCredentials implements GrantTypeInterface {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    protected $accessTokenTTL = null;
 | 
					    protected $accessTokenTTL = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Constructor
 | 
					 | 
				
			||||||
     * @param Authorization $authServer Authorization server instance
 | 
					 | 
				
			||||||
     * @return void
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public function __construct(Authorization $authServer)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->authServer = $authServer;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Return the identifier
 | 
					     * Return the identifier
 | 
				
			||||||
     * @return string
 | 
					     * @return string
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,8 +11,26 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace League\OAuth2\Server\Grant;
 | 
					namespace League\OAuth2\Server\Grant;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use League\OAuth2\Server\Authorization;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
trait GrantTrait {
 | 
					trait GrantTrait {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Constructor
 | 
				
			||||||
 | 
					     * @param Authorization $authServer Authorization server instance
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function __construct(Authorization $authServer = null)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        // @codeCoverageIgnoreStart
 | 
				
			||||||
 | 
					        if ($authServer instanceof Authorization) {
 | 
				
			||||||
 | 
					            trigger_error(
 | 
				
			||||||
 | 
					                'Server is now automatically injected into grant as of v3.1 of this library',
 | 
				
			||||||
 | 
					                E_USER_DEPRECATED
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					        } // @codeCoverageIgnoreEnd
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Return the identifier
 | 
					     * Return the identifier
 | 
				
			||||||
     * @return string
 | 
					     * @return string
 | 
				
			||||||
@@ -42,4 +60,15 @@ trait GrantTrait {
 | 
				
			|||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Inject the authorization server into the grant
 | 
				
			||||||
 | 
					     * @param Authorization $authServer The authorization server instance
 | 
				
			||||||
 | 
					     * @return  self
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function setAuthorizationServer(Authorization $authServer)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $this->authServer = $authServer;
 | 
				
			||||||
 | 
					        return $this;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -23,10 +23,9 @@ interface GrantTypeInterface
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Constructor
 | 
					     * Constructor
 | 
				
			||||||
     * @param Authorization $authServer Authorization server instance
 | 
					 | 
				
			||||||
     * @return void
 | 
					     * @return void
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public function __construct(Authorization $authServer);
 | 
					    public function __construct(Authorization $authServer = null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Complete the grant flow
 | 
					     * Complete the grant flow
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,16 +50,6 @@ class Implicit implements GrantTypeInterface {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    protected $accessTokenTTL = null;
 | 
					    protected $accessTokenTTL = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Constructor
 | 
					 | 
				
			||||||
     * @param Authorization $authServer Authorization server instance
 | 
					 | 
				
			||||||
     * @return void
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public function __construct(Authorization $authServer)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->authServer = $authServer;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Complete the client credentials grant
 | 
					     * Complete the client credentials grant
 | 
				
			||||||
     * @param  null|array $inputParams
 | 
					     * @param  null|array $inputParams
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,16 +56,6 @@ class Password implements GrantTypeInterface {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    protected $accessTokenTTL = null;
 | 
					    protected $accessTokenTTL = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Constructor
 | 
					 | 
				
			||||||
     * @param Authorization $authServer Authorization server instance
 | 
					 | 
				
			||||||
     * @return void
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public function __construct(Authorization $authServer)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->authServer = $authServer;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Set the callback to verify a user's username and password
 | 
					     * Set the callback to verify a user's username and password
 | 
				
			||||||
     * @param callable $callback The callback function
 | 
					     * @param callable $callback The callback function
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,16 +62,6 @@ class RefreshToken implements GrantTypeInterface {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    protected $rotateRefreshTokens = false;
 | 
					    protected $rotateRefreshTokens = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Constructor
 | 
					 | 
				
			||||||
     * @param Authorization $authServer Authorization server instance
 | 
					 | 
				
			||||||
     * @return void
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public function __construct(Authorization $authServer)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->authServer = $authServer;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Set the TTL of the refresh token
 | 
					     * Set the TTL of the refresh token
 | 
				
			||||||
     * @param int $refreshTokenTTL
 | 
					     * @param int $refreshTokenTTL
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,10 +20,19 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        return new League\OAuth2\Server\Authorization($this->client, $this->session, $this->scope);
 | 
					        return new League\OAuth2\Server\Authorization($this->client, $this->session, $this->scope);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function test_setAuthTokenTTL()
 | 
					    /**
 | 
				
			||||||
 | 
					    * @expectedException PHPUnit_Framework_Error
 | 
				
			||||||
 | 
					    */
 | 
				
			||||||
 | 
					    public function test__construct()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $grant = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $grant = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function test_setAuthTokenTTL()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
 | 
					        $grant = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $grant->setAuthTokenTTL(30);
 | 
					        $grant->setAuthTokenTTL(30);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $reflector = new ReflectionClass($grant);
 | 
					        $reflector = new ReflectionClass($grant);
 | 
				
			||||||
@@ -41,7 +50,7 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_checkAuthoriseParams_noClientId()
 | 
					    public function test_checkAuthoriseParams_noClientId()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $g->checkAuthoriseParams();
 | 
					        $g->checkAuthoriseParams();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -53,7 +62,7 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_checkAuthoriseParams_noRedirectUri()
 | 
					    public function test_checkAuthoriseParams_noRedirectUri()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $g->checkAuthoriseParams(array(
 | 
					        $g->checkAuthoriseParams(array(
 | 
				
			||||||
            'client_id' =>  1234
 | 
					            'client_id' =>  1234
 | 
				
			||||||
@@ -67,7 +76,7 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_checkAuthoriseParams_noRequiredState()
 | 
					    public function test_checkAuthoriseParams_noRequiredState()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $a->requireStateParam(true);
 | 
					        $a->requireStateParam(true);
 | 
				
			||||||
        $g->checkAuthoriseParams(array(
 | 
					        $g->checkAuthoriseParams(array(
 | 
				
			||||||
@@ -86,7 +95,7 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
					        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $g->checkAuthoriseParams(array(
 | 
					        $g->checkAuthoriseParams(array(
 | 
				
			||||||
            'client_id' =>  1234,
 | 
					            'client_id' =>  1234,
 | 
				
			||||||
@@ -108,7 +117,7 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        ));
 | 
					        ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $g->checkAuthoriseParams(array(
 | 
					        $g->checkAuthoriseParams(array(
 | 
				
			||||||
            'client_id' =>  1234,
 | 
					            'client_id' =>  1234,
 | 
				
			||||||
@@ -130,7 +139,7 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        ));
 | 
					        ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $g->checkAuthoriseParams(array(
 | 
					        $g->checkAuthoriseParams(array(
 | 
				
			||||||
            'client_id' =>  1234,
 | 
					            'client_id' =>  1234,
 | 
				
			||||||
@@ -153,9 +162,9 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        ));
 | 
					        ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
        $a->requireScopeParam(true);
 | 
					        $a->requireScopeParam(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $g->checkAuthoriseParams(array(
 | 
					        $g->checkAuthoriseParams(array(
 | 
				
			||||||
@@ -183,9 +192,9 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        ));
 | 
					        ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
        $a->setDefaultScope('test.scope');
 | 
					        $a->setDefaultScope('test.scope');
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -217,9 +226,9 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        ));
 | 
					        ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
        $a->setDefaultScope(array('test.scope', 'test.scope2'));
 | 
					        $a->setDefaultScope(array('test.scope', 'test.scope2'));
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -250,9 +259,9 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->scope->shouldReceive('getScope')->andReturn(false);
 | 
					        $this->scope->shouldReceive('getScope')->andReturn(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $g->checkAuthoriseParams(array(
 | 
					        $g->checkAuthoriseParams(array(
 | 
				
			||||||
            'client_id' =>  1234,
 | 
					            'client_id' =>  1234,
 | 
				
			||||||
@@ -265,9 +274,9 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_checkAuthoriseParams_passedInput()
 | 
					    public function test_checkAuthoriseParams_passedInput()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
					        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
				
			||||||
            'client_id' =>  1234,
 | 
					            'client_id' =>  1234,
 | 
				
			||||||
@@ -331,9 +340,9 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        ));
 | 
					        ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $_GET['client_id'] = 1234;
 | 
					        $_GET['client_id'] = 1234;
 | 
				
			||||||
        $_GET['redirect_uri'] = 'http://foo/redirect';
 | 
					        $_GET['redirect_uri'] = 'http://foo/redirect';
 | 
				
			||||||
@@ -380,7 +389,7 @@ class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateAuthCodeScope')->andReturn(null);
 | 
					        $this->session->shouldReceive('associateAuthCodeScope')->andReturn(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $g = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $g = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $a->addGrantType($g);
 | 
					        $a->addGrantType($g);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $params = array(
 | 
					        $params = array(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,6 +69,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $grant = M::mock('League\OAuth2\Server\Grant\GrantTypeInterface');
 | 
					        $grant = M::mock('League\OAuth2\Server\Grant\GrantTypeInterface');
 | 
				
			||||||
        $grant->shouldReceive('getResponseType')->andReturn('test');
 | 
					        $grant->shouldReceive('getResponseType')->andReturn('test');
 | 
				
			||||||
 | 
					        $grant->shouldReceive('setAuthorizationServer')->andReturn($grant);
 | 
				
			||||||
        $a->addGrantType($grant, 'test');
 | 
					        $a->addGrantType($grant, 'test');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->assertTrue($a->hasGrantType('test'));
 | 
					        $this->assertTrue($a->hasGrantType('test'));
 | 
				
			||||||
@@ -80,6 +81,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $grant = M::mock('League\OAuth2\Server\Grant\GrantTypeInterface');
 | 
					        $grant = M::mock('League\OAuth2\Server\Grant\GrantTypeInterface');
 | 
				
			||||||
        $grant->shouldReceive('getIdentifier')->andReturn('test');
 | 
					        $grant->shouldReceive('getIdentifier')->andReturn('test');
 | 
				
			||||||
        $grant->shouldReceive('getResponseType')->andReturn('test');
 | 
					        $grant->shouldReceive('getResponseType')->andReturn('test');
 | 
				
			||||||
 | 
					        $grant->shouldReceive('setAuthorizationServer')->andReturn($grant);
 | 
				
			||||||
        $a->addGrantType($grant);
 | 
					        $a->addGrantType($grant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->assertTrue($a->hasGrantType('test'));
 | 
					        $this->assertTrue($a->hasGrantType('test'));
 | 
				
			||||||
@@ -199,7 +201,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_getGrantType()
 | 
					    public function test_getGrantType()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $reflector = new ReflectionClass($a);
 | 
					        $reflector = new ReflectionClass($a);
 | 
				
			||||||
        $method = $reflector->getMethod('getGrantType');
 | 
					        $method = $reflector->getMethod('getGrantType');
 | 
				
			||||||
@@ -227,7 +229,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_missingGrantType()
 | 
					    public function test_issueAccessToken_missingGrantType()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a->issueAccessToken();
 | 
					        $a->issueAccessToken();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -239,7 +241,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_badGrantType()
 | 
					    public function test_issueAccessToken_badGrantType()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a->issueAccessToken(array('grant_type' => 'foo'));
 | 
					        $a->issueAccessToken(array('grant_type' => 'foo'));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -251,7 +253,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_missingClientId()
 | 
					    public function test_issueAccessToken_missingClientId()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a->issueAccessToken(array(
 | 
					        $a->issueAccessToken(array(
 | 
				
			||||||
            'grant_type'    =>  'authorization_code'
 | 
					            'grant_type'    =>  'authorization_code'
 | 
				
			||||||
@@ -265,7 +267,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_missingClientSecret()
 | 
					    public function test_issueAccessToken_missingClientSecret()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a->issueAccessToken(array(
 | 
					        $a->issueAccessToken(array(
 | 
				
			||||||
            'grant_type'    =>  'authorization_code',
 | 
					            'grant_type'    =>  'authorization_code',
 | 
				
			||||||
@@ -280,7 +282,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_missingRedirectUri()
 | 
					    public function test_issueAccessToken_missingRedirectUri()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a->issueAccessToken(array(
 | 
					        $a->issueAccessToken(array(
 | 
				
			||||||
            'grant_type'    =>  'authorization_code',
 | 
					            'grant_type'    =>  'authorization_code',
 | 
				
			||||||
@@ -298,7 +300,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
					        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a->issueAccessToken(array(
 | 
					        $a->issueAccessToken(array(
 | 
				
			||||||
            'grant_type'    =>  'authorization_code',
 | 
					            'grant_type'    =>  'authorization_code',
 | 
				
			||||||
@@ -317,7 +319,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->client->shouldReceive('getClient')->andReturn(array());
 | 
					        $this->client->shouldReceive('getClient')->andReturn(array());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a->issueAccessToken(array(
 | 
					        $a->issueAccessToken(array(
 | 
				
			||||||
            'grant_type'    =>  'authorization_code',
 | 
					            'grant_type'    =>  'authorization_code',
 | 
				
			||||||
@@ -337,7 +339,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('validateAuthCode')->andReturn(false);
 | 
					        $this->session->shouldReceive('validateAuthCode')->andReturn(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a->issueAccessToken(array(
 | 
					        $a->issueAccessToken(array(
 | 
				
			||||||
            'grant_type'    =>  'authorization_code',
 | 
					            'grant_type'    =>  'authorization_code',
 | 
				
			||||||
@@ -368,7 +370,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('getAuthCodeScopes')->andReturn(array('scope_id' => 1));
 | 
					        $this->session->shouldReceive('getAuthCodeScopes')->andReturn(array('scope_id' => 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $v = $a->issueAccessToken(array(
 | 
					        $v = $a->issueAccessToken(array(
 | 
				
			||||||
            'grant_type'    =>  'authorization_code',
 | 
					            'grant_type'    =>  'authorization_code',
 | 
				
			||||||
@@ -404,7 +406,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
					        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $_POST['grant_type'] = 'authorization_code';
 | 
					        $_POST['grant_type'] = 'authorization_code';
 | 
				
			||||||
        $_POST['client_id'] = 1234;
 | 
					        $_POST['client_id'] = 1234;
 | 
				
			||||||
@@ -443,7 +445,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
					        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $grant = new League\OAuth2\Server\Grant\AuthCode($a);
 | 
					        $grant = new League\OAuth2\Server\Grant\AuthCode();
 | 
				
			||||||
        $grant->setAccessTokenTTL(30);
 | 
					        $grant->setAccessTokenTTL(30);
 | 
				
			||||||
        $a->addGrantType($grant);
 | 
					        $a->addGrantType($grant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -486,7 +488,7 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
					        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $_POST['grant_type'] = 'authorization_code';
 | 
					        $_POST['grant_type'] = 'authorization_code';
 | 
				
			||||||
        $_SERVER['PHP_AUTH_USER'] = 1234;
 | 
					        $_SERVER['PHP_AUTH_USER'] = 1234;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_clientCredentialsGrant_missingClientId()
 | 
					    public function test_issueAccessToken_clientCredentialsGrant_missingClientId()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -44,7 +44,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_clientCredentialsGrant_missingClientPassword()
 | 
					    public function test_issueAccessToken_clientCredentialsGrant_missingClientPassword()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -64,7 +64,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
					        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -95,7 +95,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('deleteSession')->andReturn(null);
 | 
					        $this->session->shouldReceive('deleteSession')->andReturn(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
        $a->requireScopeParam(true);
 | 
					        $a->requireScopeParam(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a->issueAccessToken(array(
 | 
					        $a->issueAccessToken(array(
 | 
				
			||||||
@@ -129,7 +129,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
					        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
        $a->setDefaultScope('foobar');
 | 
					        $a->setDefaultScope('foobar');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -170,7 +170,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
					        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
        $a->setDefaultScope(array('foobar', 'barfoo'));
 | 
					        $a->setDefaultScope(array('foobar', 'barfoo'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -209,7 +209,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
					        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a->issueAccessToken(array(
 | 
					        $a->issueAccessToken(array(
 | 
				
			||||||
            'grant_type'    =>  'client_credentials',
 | 
					            'grant_type'    =>  'client_credentials',
 | 
				
			||||||
@@ -243,7 +243,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
					        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $v = $a->issueAccessToken(array(
 | 
					        $v = $a->issueAccessToken(array(
 | 
				
			||||||
            'grant_type'    =>  'client_credentials',
 | 
					            'grant_type'    =>  'client_credentials',
 | 
				
			||||||
@@ -275,7 +275,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
					        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $v = $a->issueAccessToken(array(
 | 
					        $v = $a->issueAccessToken(array(
 | 
				
			||||||
@@ -310,7 +310,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
					        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $_POST['grant_type'] = 'client_credentials';
 | 
					        $_POST['grant_type'] = 'client_credentials';
 | 
				
			||||||
@@ -348,7 +348,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
					        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $grant = new League\OAuth2\Server\Grant\ClientCredentials($a);
 | 
					        $grant = new League\OAuth2\Server\Grant\ClientCredentials();
 | 
				
			||||||
        $grant->setAccessTokenTTL(30);
 | 
					        $grant->setAccessTokenTTL(30);
 | 
				
			||||||
        $a->addGrantType($grant);
 | 
					        $a->addGrantType($grant);
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
@@ -390,7 +390,7 @@ class Client_Credentials_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
					        $this->session->shouldReceive('associateAccessToken')->andReturn(1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\ClientCredentials());
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $_POST['grant_type'] = 'client_credentials';
 | 
					        $_POST['grant_type'] = 'client_credentials';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_passwordGrant_missingClientId()
 | 
					    public function test_issueAccessToken_passwordGrant_missingClientId()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\Password($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\Password());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -44,7 +44,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_passwordGrant_missingClientPassword()
 | 
					    public function test_issueAccessToken_passwordGrant_missingClientPassword()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\Password($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\Password());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -64,7 +64,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
					        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\Password($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\Password());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -98,7 +98,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = null;
 | 
					        $testCredentials = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -134,7 +134,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return false; };
 | 
					        $testCredentials = function() { return false; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -168,7 +168,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return false; };
 | 
					        $testCredentials = function() { return false; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -203,7 +203,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return false; };
 | 
					        $testCredentials = function() { return false; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -240,7 +240,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return 1; };
 | 
					        $testCredentials = function() { return 1; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -276,7 +276,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return 1; };
 | 
					        $testCredentials = function() { return 1; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
        $a->requireScopeParam(true);
 | 
					        $a->requireScopeParam(true);
 | 
				
			||||||
@@ -317,7 +317,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return 1; };
 | 
					        $testCredentials = function() { return 1; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
@@ -365,7 +365,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return 1; };
 | 
					        $testCredentials = function() { return 1; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
@@ -413,7 +413,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return 1; };
 | 
					        $testCredentials = function() { return 1; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -452,7 +452,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return 1; };
 | 
					        $testCredentials = function() { return 1; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
@@ -494,7 +494,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return 1; };
 | 
					        $testCredentials = function() { return 1; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
@@ -539,7 +539,7 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return 1; };
 | 
					        $testCredentials = function() { return 1; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $pgrant->setAccessTokenTTL(30);
 | 
					        $pgrant->setAccessTokenTTL(30);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
@@ -587,10 +587,10 @@ class Password_Grant_Test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $testCredentials = function() { return 1; };
 | 
					        $testCredentials = function() { return 1; };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $pgrant = new League\OAuth2\Server\Grant\Password($a);
 | 
					        $pgrant = new League\OAuth2\Server\Grant\Password();
 | 
				
			||||||
        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
					        $pgrant->setVerifyCredentialsCallback($testCredentials);
 | 
				
			||||||
        $a->addGrantType($pgrant);
 | 
					        $a->addGrantType($pgrant);
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken());
 | 
				
			||||||
        $a->requireScopeParam(false);
 | 
					        $a->requireScopeParam(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $_POST['grant_type'] = 'password';
 | 
					        $_POST['grant_type'] = 'password';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,7 +23,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_setRefreshTokenTTL()
 | 
					    public function test_setRefreshTokenTTL()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $rt = new League\OAuth2\Server\Grant\RefreshToken($a);
 | 
					        $rt = new League\OAuth2\Server\Grant\RefreshToken();
 | 
				
			||||||
        $rt->setRefreshTokenTTL(30);
 | 
					        $rt->setRefreshTokenTTL(30);
 | 
				
			||||||
        $this->assertEquals(30, $rt->getRefreshTokenTTL());
 | 
					        $this->assertEquals(30, $rt->getRefreshTokenTTL());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -46,8 +46,8 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('getAuthCodeScopes')->andReturn(array('scope_id' => 1));
 | 
					        $this->session->shouldReceive('getAuthCodeScopes')->andReturn(array('scope_id' => 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\AuthCode());
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $_POST['grant_type'] = 'authorization_code';
 | 
					        $_POST['grant_type'] = 'authorization_code';
 | 
				
			||||||
        $_POST['client_id'] = 1234;
 | 
					        $_POST['client_id'] = 1234;
 | 
				
			||||||
@@ -77,7 +77,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_refreshTokenGrant_missingClientId()
 | 
					    public function test_issueAccessToken_refreshTokenGrant_missingClientId()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -94,7 +94,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
    public function test_issueAccessToken_refreshTokenGrant_missingClientSecret()
 | 
					    public function test_issueAccessToken_refreshTokenGrant_missingClientSecret()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -114,7 +114,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
					        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -135,7 +135,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->client->shouldReceive('getClient')->andReturn(array());
 | 
					        $this->client->shouldReceive('getClient')->andReturn(array());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -157,7 +157,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('validateRefreshToken')->andReturn(false);
 | 
					        $this->session->shouldReceive('validateRefreshToken')->andReturn(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
					        $request = new League\OAuth2\Server\Util\Request(array(), $_POST);
 | 
				
			||||||
        $a->setRequest($request);
 | 
					        $a->setRequest($request);
 | 
				
			||||||
@@ -190,7 +190,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('getScopes')->andReturn(array());
 | 
					        $this->session->shouldReceive('getScopes')->andReturn(array());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $_POST['grant_type'] = 'refresh_token';
 | 
					        $_POST['grant_type'] = 'refresh_token';
 | 
				
			||||||
        $_POST['client_id'] = 1234;
 | 
					        $_POST['client_id'] = 1234;
 | 
				
			||||||
@@ -232,7 +232,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
					        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken($a));
 | 
					        $a->addGrantType(new League\OAuth2\Server\Grant\RefreshToken());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $v = $a->issueAccessToken(array(
 | 
					        $v = $a->issueAccessToken(array(
 | 
				
			||||||
            'grant_type'    =>  'refresh_token',
 | 
					            'grant_type'    =>  'refresh_token',
 | 
				
			||||||
@@ -272,7 +272,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $rt = new League\OAuth2\Server\Grant\RefreshToken($a);
 | 
					        $rt = new League\OAuth2\Server\Grant\RefreshToken();
 | 
				
			||||||
        $rt->rotateRefreshTokens(true);
 | 
					        $rt->rotateRefreshTokens(true);
 | 
				
			||||||
        $a->addGrantType($rt);
 | 
					        $a->addGrantType($rt);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -314,7 +314,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
					        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $grant = new League\OAuth2\Server\Grant\RefreshToken($a);
 | 
					        $grant = new League\OAuth2\Server\Grant\RefreshToken();
 | 
				
			||||||
        $grant->setAccessTokenTTL(30);
 | 
					        $grant->setAccessTokenTTL(30);
 | 
				
			||||||
        $a->addGrantType($grant);
 | 
					        $a->addGrantType($grant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -358,7 +358,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->scope->shouldReceive('getScope')->andReturn(array('id' => 1, 'scope' => 'foo'));
 | 
					        $this->scope->shouldReceive('getScope')->andReturn(array('id' => 1, 'scope' => 'foo'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $grant = new League\OAuth2\Server\Grant\RefreshToken($a);
 | 
					        $grant = new League\OAuth2\Server\Grant\RefreshToken();
 | 
				
			||||||
        $grant->setAccessTokenTTL(30);
 | 
					        $grant->setAccessTokenTTL(30);
 | 
				
			||||||
        $grant->rotateRefreshTokens(true);
 | 
					        $grant->rotateRefreshTokens(true);
 | 
				
			||||||
        $a->addGrantType($grant);
 | 
					        $a->addGrantType($grant);
 | 
				
			||||||
@@ -409,7 +409,7 @@ class Refresh_Token_test extends PHPUnit_Framework_TestCase
 | 
				
			|||||||
        $this->scope->shouldReceive('getScope')->andReturn(array('id' => 1, 'scope' => 'foo'));
 | 
					        $this->scope->shouldReceive('getScope')->andReturn(array('id' => 1, 'scope' => 'foo'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $a = $this->returnDefault();
 | 
					        $a = $this->returnDefault();
 | 
				
			||||||
        $grant = new League\OAuth2\Server\Grant\RefreshToken($a);
 | 
					        $grant = new League\OAuth2\Server\Grant\RefreshToken();
 | 
				
			||||||
        $grant->setAccessTokenTTL(30);
 | 
					        $grant->setAccessTokenTTL(30);
 | 
				
			||||||
        $grant->rotateRefreshTokens(true);
 | 
					        $grant->rotateRefreshTokens(true);
 | 
				
			||||||
        $a->addGrantType($grant);
 | 
					        $a->addGrantType($grant);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user