Various bug fixes

This commit is contained in:
Alex Bilbie 2013-02-05 16:20:45 +00:00
parent f481a9baeb
commit 562c257596

View File

@ -5,6 +5,7 @@ namespace OAuth2;
use OutOfBoundsException; use OutOfBoundsException;
use OAuth2\Storage\SessionInterface; use OAuth2\Storage\SessionInterface;
use OAuth2\Storage\SessionScopeInterface; use OAuth2\Storage\SessionScopeInterface;
use OAuth2\Util\RequestInterface;
class ResourceServer class ResourceServer
{ {
@ -30,10 +31,9 @@ class ResourceServer
* @param SessionInterface The Session Storage Object * @param SessionInterface The Session Storage Object
* @param SessionScopeInterface The Session Scope Storage Object * @param SessionScopeInterface The Session Scope Storage Object
*/ */
public function __construct(SessionInterface $session, SessionScopeInterface $session_scope) public function __construct(SessionInterface $session)
{ {
$this->storages['session'] = $session; $this->storages['session'] = $session;
$this->storages['session_scope'] = $session_scope;
} }
/** /**
@ -54,12 +54,24 @@ class ResourceServer
public function getRequest() public function getRequest()
{ {
if ($this->request === null) { if ($this->request === null) {
// @codeCoverageIgnoreStart
$this->request = Request::buildFromGlobals(); $this->request = Request::buildFromGlobals();
} }
// @codeCoverageIgnoreEnd
return $this->request; return $this->request;
} }
public function getTokenKey()
{
return $this->tokenKey;
}
public function setTokenKey($key)
{
$this->tokenKey = $key;
}
/** /**
* Gets the Owner ID. * Gets the Owner ID.
* *
@ -77,7 +89,7 @@ class ResourceServer
*/ */
public function getOwnerType() public function getOwnerType()
{ {
return $this->ownerId; return $this->ownerType;
} }
/** /**
@ -110,7 +122,7 @@ class ResourceServer
$this->ownerType = $result['owner_type']; $this->ownerType = $result['owner_type'];
$this->ownerId = $result['owner_id']; $this->ownerId = $result['owner_id'];
$this->sessionScopes = $this->storages['session_scope']->getScopes($this->sessionId); $this->sessionScopes = $this->storages['session']->getScopes($this->sessionId);
return true; return true;
} }