This commit is contained in:
Alex Bilbie 2014-11-08 16:20:13 +00:00
parent fa55a791e7
commit 856051bfb3
2 changed files with 0 additions and 78 deletions

View File

@ -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

View File

@ -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'));
}
}