From 856051bfb3e7205510a797253f50d85307b7d5ba Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 8 Nov 2014 16:20:13 +0000 Subject: [PATCH] Fix #232 --- src/ResourceServer.php | 67 ------------------------------- tests/unit/ResourceServerTest.php | 11 ----- 2 files changed, 78 deletions(-) diff --git a/src/ResourceServer.php b/src/ResourceServer.php index dc8f0505..f9d9f6ea 100644 --- a/src/ResourceServer.php +++ b/src/ResourceServer.php @@ -64,15 +64,6 @@ class ResourceServer extends AbstractServer return $this; } - /** - * Returns the query string key for the access token. - * @return string - */ - public function getIdKey() - { - return $this->tokenKey; - } - /** * Sets the query string key for the access token. * @param $key The new query string key @@ -85,24 +76,6 @@ class ResourceServer extends AbstractServer return $this; } - /** - * Gets the access token owner ID - * @return string - */ - public function getOwnerId() - { - return $this->accessToken->getSession()->getOwnerId(); - } - - /** - * Gets the owner type - * @return string - */ - public function getOwnerType() - { - return $this->accessToken->getSession()->getOwnerType(); - } - /** * Gets the access token * @return string @@ -112,46 +85,6 @@ class ResourceServer extends AbstractServer return $this->accessToken->getId(); } - /** - * Gets the client ID that created the session - * @return string - */ - public function getClientId() - { - return $this->accessToken->getSession()->getClient()->getId(); - } - - /** - * Get the session scopes - * @return array - */ - public function getScopes() - { - return $this->accessToken->getScopes(); - } - - /** - * Checks if the presented access token has the given scope(s) - * @param array|string $scopes An array of scopes or a single scope as a string - * @return bool Returns bool if all scopes are found, false if any fail - */ - public function hasScope($scopes) - { - if (is_string($scopes)) { - return $this->accessToken->hasScope($scopes); - } - - if (is_array($scopes)) { - foreach ($scopes as $scope) { - if (!$this->accessToken->hasScope($scope)) { - return false; - } - } - } - - return true; - } - /** * Checks if the access token is valid or not * @param $headersOnly Limit Access Token to Authorization header only diff --git a/tests/unit/ResourceServerTest.php b/tests/unit/ResourceServerTest.php index 7fce1600..16d35b3f 100644 --- a/tests/unit/ResourceServerTest.php +++ b/tests/unit/ResourceServerTest.php @@ -165,17 +165,6 @@ class ResourceServerTest extends \PHPUnit_Framework_TestCase $server->setRequest($request); $this->assertTrue($server->isValidRequest()); - $this->assertEquals('at', $server->getIdKey()); - $this->assertEquals(123, $server->getOwnerId()); - $this->assertEquals('user', $server->getOwnerType()); $this->assertEquals('abcdef', $server->getAccessToken()); - $this->assertEquals('testapp', $server->getClientId()); - $this->assertTrue($server->hasScope('foo')); - $this->assertTrue($server->hasScope('bar')); - $this->assertTrue($server->hasScope(['foo', 'bar'])); - $this->assertTrue(isset($server->getScopes()['foo'])); - $this->assertTrue(isset($server->getScopes()['bar'])); - $this->assertFalse($server->hasScope(['foobar'])); - $this->assertFalse($server->hasScope('foobar')); } }