mirror of
				https://github.com/elyby/oauth2-server.git
				synced 2025-05-31 14:12:07 +05:30 
			
		
		
		
	Move authorisation code grant stuff into own grant
This commit is contained in:
		@@ -385,105 +385,6 @@ class AuthServer
 | 
			
		||||
        return $this->storages[$obj];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Check authorise parameters
 | 
			
		||||
     *
 | 
			
		||||
     * @param  array $inputParams Optional array of parsed $_GET keys
 | 
			
		||||
     * @throws \OAuth2\Exception\ClientException
 | 
			
		||||
     * @return array             Authorise request parameters
 | 
			
		||||
     */
 | 
			
		||||
    public function checkAuthoriseParams($inputParams = array())
 | 
			
		||||
    {
 | 
			
		||||
        // Auth params
 | 
			
		||||
        $authParams = $this->getParam(array('client_id', 'redirect_uri', 'response_type', 'scope', 'state'), 'get', $inputParams);
 | 
			
		||||
 | 
			
		||||
        if (is_null($authParams['client_id'])) {
 | 
			
		||||
            throw new Exception\ClientException(sprintf(self::$exceptionMessages['invalid_request'], 'client_id'), 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (is_null($authParams['redirect_uri'])) {
 | 
			
		||||
            throw new Exception\ClientException(sprintf(self::$exceptionMessages['invalid_request'], 'redirect_uri'), 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->requireStateParam === true && is_null($authParams['state'])) {
 | 
			
		||||
            throw new Exception\ClientException(sprintf(self::$exceptionMessages['invalid_request'], 'state'), 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Validate client ID and redirect URI
 | 
			
		||||
        $clientDetails = $this->getStorage('client')->getClient($authParams['client_id'], null, $authParams['redirect_uri']);
 | 
			
		||||
 | 
			
		||||
        if ($clientDetails === false) {
 | 
			
		||||
            throw new Exception\ClientException(self::$exceptionMessages['invalid_client'], 8);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $authParams['client_details'] = $clientDetails;
 | 
			
		||||
 | 
			
		||||
        if (is_null($authParams['response_type'])) {
 | 
			
		||||
            throw new Exception\ClientException(sprintf(self::$exceptionMessages['invalid_request'], 'response_type'), 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Ensure response type is one that is recognised
 | 
			
		||||
        if ( ! in_array($authParams['response_type'], $this->responseTypes)) {
 | 
			
		||||
            throw new Exception\ClientException(self::$exceptionMessages['unsupported_response_type'], 3);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Validate scopes
 | 
			
		||||
        $scopes = explode($this->scopeDelimeter, $authParams['scope']);
 | 
			
		||||
 | 
			
		||||
        for ($i = 0; $i < count($scopes); $i++) {
 | 
			
		||||
            $scopes[$i] = trim($scopes[$i]);
 | 
			
		||||
            if ($scopes[$i] === '') unset($scopes[$i]); // Remove any junk scopes
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->requireScopeParam === true && count($scopes) === 0) {
 | 
			
		||||
            throw new Exception\ClientException(sprintf(self::$exceptionMessages['invalid_request'], 'scope'), 0);
 | 
			
		||||
        } elseif (count($scopes) === 0 && $this->defaultScope) {
 | 
			
		||||
            $scopes = array($this->defaultScope);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $authParams['scopes'] = array();
 | 
			
		||||
 | 
			
		||||
        foreach ($scopes as $scope) {
 | 
			
		||||
            $scopeDetails = $this->getStorage('scope')->getScope($scope);
 | 
			
		||||
 | 
			
		||||
            if ($scopeDetails === false) {
 | 
			
		||||
                throw new Exception\ClientException(sprintf(self::$exceptionMessages['invalid_scope'], $scope), 4);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $authParams['scopes'][] = $scopeDetails;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $authParams;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Parse a new authorise request
 | 
			
		||||
     *
 | 
			
		||||
     * @param  string $type        The session owner's type
 | 
			
		||||
     * @param  string $typeId      The session owner's ID
 | 
			
		||||
     * @param  array  $authParams  The authorise request $_GET parameters
 | 
			
		||||
     * @return string              An authorisation code
 | 
			
		||||
     */
 | 
			
		||||
    public function newAuthoriseRequest($type, $typeId, $authParams = array())
 | 
			
		||||
    {
 | 
			
		||||
        // Generate an auth code
 | 
			
		||||
        $authCode = SecureKey::make();
 | 
			
		||||
 | 
			
		||||
        // Remove any old sessions the user might have
 | 
			
		||||
        $this->getStorage('session')->deleteSession($authParams['client_id'], $type, $typeId);
 | 
			
		||||
 | 
			
		||||
        // Create a new session
 | 
			
		||||
        $sessionId = $this->getStorage('session')->createSession($authParams['client_id'], $authParams['redirect_uri'], $type, $typeId, $authCode);
 | 
			
		||||
 | 
			
		||||
        // Associate scopes with the new session
 | 
			
		||||
        foreach ($authParams['scopes'] as $scope)
 | 
			
		||||
        {
 | 
			
		||||
            $this->getStorage('session')->associateScope($sessionId, $scope['id']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $authCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Issue an access token
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -70,6 +70,105 @@ class AuthCode implements GrantTypeInterface {
 | 
			
		||||
        return $this->responseType;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Check authorise parameters
 | 
			
		||||
     *
 | 
			
		||||
     * @param  array $inputParams Optional array of parsed $_GET keys
 | 
			
		||||
     * @throws \OAuth2\Exception\ClientException
 | 
			
		||||
     * @return array             Authorise request parameters
 | 
			
		||||
     */
 | 
			
		||||
    public function checkAuthoriseParams($inputParams = array())
 | 
			
		||||
    {
 | 
			
		||||
        // Auth params
 | 
			
		||||
        $authParams = $this->authServer->getParam(array('client_id', 'redirect_uri', 'response_type', 'scope', 'state'), 'get', $inputParams);
 | 
			
		||||
 | 
			
		||||
        if (is_null($authParams['client_id'])) {
 | 
			
		||||
            throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'client_id'), 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (is_null($authParams['redirect_uri'])) {
 | 
			
		||||
            throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'redirect_uri'), 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->authServer->scopeParamRequired() === true && is_null($authParams['state'])) {
 | 
			
		||||
            throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'state'), 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Validate client ID and redirect URI
 | 
			
		||||
        $clientDetails = $this->authServer->getStorage('client')->getClient($authParams['client_id'], null, $authParams['redirect_uri']);
 | 
			
		||||
 | 
			
		||||
        if ($clientDetails === false) {
 | 
			
		||||
            throw new Exception\ClientException($this->authServer->getExceptionMessage('invalid_client'), 8);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $authParams['client_details'] = $clientDetails;
 | 
			
		||||
 | 
			
		||||
        if (is_null($authParams['response_type'])) {
 | 
			
		||||
            throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'response_type'), 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Ensure response type is one that is recognised
 | 
			
		||||
        if ( ! in_array($authParams['response_type'], $this->authServer->getResponseTypes())) {
 | 
			
		||||
            throw new Exception\ClientException($this->authServer->getExceptionMessage('unsupported_response_type'), 3);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Validate scopes
 | 
			
		||||
        $scopes = explode($this->authServer->getScopeDelimeter(), $authParams['scope']);
 | 
			
		||||
 | 
			
		||||
        for ($i = 0; $i < count($scopes); $i++) {
 | 
			
		||||
            $scopes[$i] = trim($scopes[$i]);
 | 
			
		||||
            if ($scopes[$i] === '') unset($scopes[$i]); // Remove any junk scopes
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->authServer->scopeParamRequired() === true && count($scopes) === 0) {
 | 
			
		||||
            throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'scope'), 0);
 | 
			
		||||
        } elseif (count($scopes) === 0 && $this->authServer->getDefaultScope()) {
 | 
			
		||||
            $scopes = array($this->authServer->getDefaultScope());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $authParams['scopes'] = array();
 | 
			
		||||
 | 
			
		||||
        foreach ($scopes as $scope) {
 | 
			
		||||
            $scopeDetails = $this->authServer->getStorage('scope')->getScope($scope, $authParams['client_id'], $this->identifier);
 | 
			
		||||
 | 
			
		||||
            if ($scopeDetails === false) {
 | 
			
		||||
                throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_scope'), $scope), 4);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            $authParams['scopes'][] = $scopeDetails;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $authParams;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Parse a new authorise request
 | 
			
		||||
     *
 | 
			
		||||
     * @param  string $type        The session owner's type
 | 
			
		||||
     * @param  string $typeId      The session owner's ID
 | 
			
		||||
     * @param  array  $authParams  The authorise request $_GET parameters
 | 
			
		||||
     * @return string              An authorisation code
 | 
			
		||||
     */
 | 
			
		||||
    public function newAuthoriseRequest($type, $typeId, $authParams = array())
 | 
			
		||||
    {
 | 
			
		||||
        // Generate an auth code
 | 
			
		||||
        $authCode = SecureKey::make();
 | 
			
		||||
 | 
			
		||||
        // Remove any old sessions the user might have
 | 
			
		||||
        $this->authServer->getStorage('session')->deleteSession($authParams['client_id'], $type, $typeId);
 | 
			
		||||
 | 
			
		||||
        // Create a new session
 | 
			
		||||
        $sessionId = $this->authServer->getStorage('session')->createSession($authParams['client_id'], $authParams['redirect_uri'], $type, $typeId, $authCode);
 | 
			
		||||
 | 
			
		||||
        // Associate scopes with the new session
 | 
			
		||||
        foreach ($authParams['scopes'] as $scope)
 | 
			
		||||
        {
 | 
			
		||||
            $this->authServer->getStorage('session')->associateScope($sessionId, $scope['id']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $authCode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Complete the auth code grant
 | 
			
		||||
     * @param  null|array $inputParams
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										359
									
								
								tests/authorization/AuthCodeGrantTest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										359
									
								
								tests/authorization/AuthCodeGrantTest.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,359 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use \Mockery as m;
 | 
			
		||||
 | 
			
		||||
class Auth_Code_Grant_Test extends PHPUnit_Framework_TestCase
 | 
			
		||||
{
 | 
			
		||||
    private $client;
 | 
			
		||||
    private $session;
 | 
			
		||||
    private $scope;
 | 
			
		||||
 | 
			
		||||
    public function setUp()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client = M::mock('OAuth2\Storage\ClientInterface');
 | 
			
		||||
        $this->session = M::mock('OAuth2\Storage\SessionInterface');
 | 
			
		||||
        $this->scope = M::mock('OAuth2\Storage\ScopeInterface');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function returnDefault()
 | 
			
		||||
    {
 | 
			
		||||
        return new OAuth2\AuthServer($this->client, $this->session, $this->scope);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    0
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_noClientId()
 | 
			
		||||
    {
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $g->checkAuthoriseParams();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    0
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_noRedirectUri()
 | 
			
		||||
    {
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $g->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    0
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_noRequiredState()
 | 
			
		||||
    {
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $a->requireStateParam(true);
 | 
			
		||||
        $g->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect'
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    8
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_badClient()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $g->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect'
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    0
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_missingResponseType()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $g->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect'
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    3
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_badResponseType()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $g->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'response_type' =>  'foo'
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    0
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_missingScopes()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $a->addGrantType(new OAuth2\Grant\AuthCode($a));
 | 
			
		||||
 | 
			
		||||
        $g->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scope' =>  ''
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function test_checkAuthoriseParams_defaultScope()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->scope->shouldReceive('getScope')->andReturn(array(
 | 
			
		||||
            'id'    =>  1,
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'name'  =>  'Foo Name',
 | 
			
		||||
            'description'   =>  'Foo Name Description'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $a->addGrantType(new OAuth2\Grant\AuthCode($a));
 | 
			
		||||
        $a->setDefaultScope('test.scope');
 | 
			
		||||
        $a->requireScopeParam(false);
 | 
			
		||||
 | 
			
		||||
        $params = $g->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scope'    =>  ''
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->assertArrayHasKey('scopes', $params);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    4
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_badScopes()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->scope->shouldReceive('getScope')->andReturn(false);
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $a->addGrantType(new OAuth2\Grant\AuthCode($a));
 | 
			
		||||
 | 
			
		||||
        $g->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scope' =>  'foo'
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function test_checkAuthoriseParams_passedInput()
 | 
			
		||||
    {
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $a->addGrantType(new OAuth2\Grant\AuthCode($a));
 | 
			
		||||
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->scope->shouldReceive('getScope')->andReturn(array(
 | 
			
		||||
            'id'    =>  1,
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'name'  =>  'Foo Name',
 | 
			
		||||
            'description'   =>  'Foo Name Description'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $v = $g->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'state' =>  'xyz'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'client_details' => array(
 | 
			
		||||
                'client_id' => 1234,
 | 
			
		||||
                'client_secret' => 5678,
 | 
			
		||||
                'redirect_uri' => 'http://foo/redirect',
 | 
			
		||||
                'name' => 'Example Client'
 | 
			
		||||
            ),
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scopes'    =>  array(
 | 
			
		||||
                array(
 | 
			
		||||
                    'id'    =>  1,
 | 
			
		||||
                    'scope' =>  'foo',
 | 
			
		||||
                    'name'  =>  'Foo Name',
 | 
			
		||||
                    'description'   =>  'Foo Name Description'
 | 
			
		||||
                )
 | 
			
		||||
            ),
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'state' =>  'xyz'
 | 
			
		||||
        ), $v);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function test_checkAuthoriseParams()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->scope->shouldReceive('getScope')->andReturn(array(
 | 
			
		||||
            'id'    =>  1,
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'name'  =>  'Foo Name',
 | 
			
		||||
            'description'   =>  'Foo Name Description'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
        $a->addGrantType(new OAuth2\Grant\AuthCode($a));
 | 
			
		||||
 | 
			
		||||
        $_GET['client_id'] = 1234;
 | 
			
		||||
        $_GET['redirect_uri'] = 'http://foo/redirect';
 | 
			
		||||
        $_GET['response_type'] = 'code';
 | 
			
		||||
        $_GET['scope'] = 'foo';
 | 
			
		||||
        $_GET['state'] = 'xyz';
 | 
			
		||||
 | 
			
		||||
        $request = new OAuth2\Util\Request($_GET);
 | 
			
		||||
        $a->setRequest($request);
 | 
			
		||||
 | 
			
		||||
        $v = $g->checkAuthoriseParams();
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'client_details' => array(
 | 
			
		||||
                'client_id' => 1234,
 | 
			
		||||
                'client_secret' => 5678,
 | 
			
		||||
                'redirect_uri' => 'http://foo/redirect',
 | 
			
		||||
                'name' => 'Example Client'
 | 
			
		||||
            ),
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scopes'    =>  array(
 | 
			
		||||
                array(
 | 
			
		||||
                    'id'    =>  1,
 | 
			
		||||
                    'scope' =>  'foo',
 | 
			
		||||
                    'name'  =>  'Foo Name',
 | 
			
		||||
                    'description'   =>  'Foo Name Description'
 | 
			
		||||
                )
 | 
			
		||||
            ),
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'state' =>  'xyz'
 | 
			
		||||
        ), $v);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    function test_newAuthoriseRequest()
 | 
			
		||||
    {
 | 
			
		||||
        $this->session->shouldReceive('deleteSession')->andReturn(null);
 | 
			
		||||
        $this->session->shouldReceive('createSession')->andReturn(1);
 | 
			
		||||
        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $g = new OAuth2\Grant\AuthCode($a);
 | 
			
		||||
        $a->addGrantType($g);
 | 
			
		||||
 | 
			
		||||
        $params = array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'client_details' => array(
 | 
			
		||||
                'client_id' => 1234,
 | 
			
		||||
                'client_secret' => 5678,
 | 
			
		||||
                'redirect_uri' => 'http://foo/redirect',
 | 
			
		||||
                'name' => 'Example Client'
 | 
			
		||||
            ),
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scopes'    =>  array(
 | 
			
		||||
                array(
 | 
			
		||||
                    'id'    =>  1,
 | 
			
		||||
                    'scope' =>  'foo',
 | 
			
		||||
                    'name'  =>  'Foo Name',
 | 
			
		||||
                    'description'   =>  'Foo Name Description'
 | 
			
		||||
                )
 | 
			
		||||
            )
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        $v = $g->newAuthoriseRequest('user', 123, $params);
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals(40, strlen($v));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -196,315 +196,6 @@ class Authorization_Server_test extends PHPUnit_Framework_TestCase
 | 
			
		||||
        $this->assertTrue($a->getStorage('session') instanceof OAuth2\Storage\SessionInterface);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    0
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_noClientId()
 | 
			
		||||
    {
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->checkAuthoriseParams();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    0
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_noRedirectUri()
 | 
			
		||||
    {
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    0
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_noRequiredState()
 | 
			
		||||
    {
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->requireStateParam(true);
 | 
			
		||||
        $a->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect'
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    8
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_badClient()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(false);
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect'
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    0
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_missingResponseType()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect'
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    3
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_badResponseType()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'response_type' =>  'foo'
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    0
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_missingScopes()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->addGrantType(new OAuth2\Grant\AuthCode($a));
 | 
			
		||||
 | 
			
		||||
        $a->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scope' =>  ''
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function test_checkAuthoriseParams_defaultScope()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->scope->shouldReceive('getScope')->andReturn(array(
 | 
			
		||||
            'id'    =>  1,
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'name'  =>  'Foo Name',
 | 
			
		||||
            'description'   =>  'Foo Name Description'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->addGrantType(new OAuth2\Grant\AuthCode($a));
 | 
			
		||||
        $a->setDefaultScope('test.scope');
 | 
			
		||||
        $a->requireScopeParam(false);
 | 
			
		||||
 | 
			
		||||
        $params = $a->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scope'    =>  ''
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->assertArrayHasKey('scopes', $params);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @expectedException        OAuth2\Exception\ClientException
 | 
			
		||||
     * @expectedExceptionCode    4
 | 
			
		||||
     */
 | 
			
		||||
    public function test_checkAuthoriseParams_badScopes()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->scope->shouldReceive('getScope')->andReturn(false);
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->addGrantType(new OAuth2\Grant\AuthCode($a));
 | 
			
		||||
 | 
			
		||||
        $a->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scope' =>  'foo'
 | 
			
		||||
        ));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function test_checkAuthoriseParams_passedInput()
 | 
			
		||||
    {
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->addGrantType(new OAuth2\Grant\AuthCode($a));
 | 
			
		||||
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->scope->shouldReceive('getScope')->andReturn(array(
 | 
			
		||||
            'id'    =>  1,
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'name'  =>  'Foo Name',
 | 
			
		||||
            'description'   =>  'Foo Name Description'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $v = $a->checkAuthoriseParams(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'state' =>  'xyz'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'client_details' => array(
 | 
			
		||||
                'client_id' => 1234,
 | 
			
		||||
                'client_secret' => 5678,
 | 
			
		||||
                'redirect_uri' => 'http://foo/redirect',
 | 
			
		||||
                'name' => 'Example Client'
 | 
			
		||||
            ),
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scopes'    =>  array(
 | 
			
		||||
                array(
 | 
			
		||||
                    'id'    =>  1,
 | 
			
		||||
                    'scope' =>  'foo',
 | 
			
		||||
                    'name'  =>  'Foo Name',
 | 
			
		||||
                    'description'   =>  'Foo Name Description'
 | 
			
		||||
                )
 | 
			
		||||
            ),
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'state' =>  'xyz'
 | 
			
		||||
        ), $v);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function test_checkAuthoriseParams()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client->shouldReceive('getClient')->andReturn(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'client_secret' =>  5678,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'name'  =>  'Example Client'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $this->scope->shouldReceive('getScope')->andReturn(array(
 | 
			
		||||
            'id'    =>  1,
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'name'  =>  'Foo Name',
 | 
			
		||||
            'description'   =>  'Foo Name Description'
 | 
			
		||||
        ));
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
        $a->addGrantType(new OAuth2\Grant\AuthCode($a));
 | 
			
		||||
 | 
			
		||||
        $_GET['client_id'] = 1234;
 | 
			
		||||
        $_GET['redirect_uri'] = 'http://foo/redirect';
 | 
			
		||||
        $_GET['response_type'] = 'code';
 | 
			
		||||
        $_GET['scope'] = 'foo';
 | 
			
		||||
        $_GET['state'] = 'xyz';
 | 
			
		||||
 | 
			
		||||
        $request = new OAuth2\Util\Request($_GET);
 | 
			
		||||
        $a->setRequest($request);
 | 
			
		||||
 | 
			
		||||
        $v = $a->checkAuthoriseParams();
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals(array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'client_details' => array(
 | 
			
		||||
                'client_id' => 1234,
 | 
			
		||||
                'client_secret' => 5678,
 | 
			
		||||
                'redirect_uri' => 'http://foo/redirect',
 | 
			
		||||
                'name' => 'Example Client'
 | 
			
		||||
            ),
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scopes'    =>  array(
 | 
			
		||||
                array(
 | 
			
		||||
                    'id'    =>  1,
 | 
			
		||||
                    'scope' =>  'foo',
 | 
			
		||||
                    'name'  =>  'Foo Name',
 | 
			
		||||
                    'description'   =>  'Foo Name Description'
 | 
			
		||||
                )
 | 
			
		||||
            ),
 | 
			
		||||
            'scope' =>  'foo',
 | 
			
		||||
            'state' =>  'xyz'
 | 
			
		||||
        ), $v);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function test_newAuthoriseRequest()
 | 
			
		||||
    {
 | 
			
		||||
        $this->session->shouldReceive('deleteSession')->andReturn(null);
 | 
			
		||||
        $this->session->shouldReceive('createSession')->andReturn(1);
 | 
			
		||||
        $this->session->shouldReceive('associateScope')->andReturn(null);
 | 
			
		||||
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
 | 
			
		||||
        $params = array(
 | 
			
		||||
            'client_id' =>  1234,
 | 
			
		||||
            'redirect_uri'  =>  'http://foo/redirect',
 | 
			
		||||
            'client_details' => array(
 | 
			
		||||
                'client_id' => 1234,
 | 
			
		||||
                'client_secret' => 5678,
 | 
			
		||||
                'redirect_uri' => 'http://foo/redirect',
 | 
			
		||||
                'name' => 'Example Client'
 | 
			
		||||
            ),
 | 
			
		||||
            'response_type' =>  'code',
 | 
			
		||||
            'scopes'    =>  array(
 | 
			
		||||
                array(
 | 
			
		||||
                    'id'    =>  1,
 | 
			
		||||
                    'scope' =>  'foo',
 | 
			
		||||
                    'name'  =>  'Foo Name',
 | 
			
		||||
                    'description'   =>  'Foo Name Description'
 | 
			
		||||
                )
 | 
			
		||||
            )
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        $v = $a->newAuthoriseRequest('user', 123, $params);
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals(40, strlen($v));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function test_getGrantType()
 | 
			
		||||
    {
 | 
			
		||||
        $a = $this->returnDefault();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user