Updated resource server

This commit is contained in:
Alex Bilbie 2013-12-24 17:02:49 +00:00
parent e62bc4e98d
commit 5cd420bd5d

View File

@ -11,7 +11,6 @@
namespace League\OAuth2\Server; namespace League\OAuth2\Server;
use OutOfBoundsException;
use League\OAuth2\Server\Storage\SessionInterface; use League\OAuth2\Server\Storage\SessionInterface;
use League\OAuth2\Server\Storage\AccessTokenInterface; use League\OAuth2\Server\Storage\AccessTokenInterface;
use League\OAuth2\Server\Storage\ClientInterface; use League\OAuth2\Server\Storage\ClientInterface;
@ -114,10 +113,14 @@ class Resource
/** /**
* Gets the Request object. It will create one from the globals if one is not set. * Gets the Request object. It will create one from the globals if one is not set.
* *
* @return Symfony\Component\HttpFoundation\Request * @return \Symfony\Component\HttpFoundation\Request
*/ */
public function getRequest() public function getRequest()
{ {
if ($this->request = null) {
return Symfony\Component\HttpFoundation\Request::createFromGlobals();
}
return $this->request; return $this->request;
} }
@ -217,7 +220,6 @@ class Resource
$this->accessToken = $accessToken; $this->accessToken = $accessToken;
// Set the session // Set the session
$sessionResult = $this->sessionStorage->getSession($tokenResult['session_id']); $sessionResult = $this->sessionStorage->getSession($tokenResult['session_id']);
if ($sessionResult === null) { if ($sessionResult === null) {
@ -300,7 +302,6 @@ class Resource
} }
$accessToken = ($accessToken === 'Bearer') ? '' : $accessToken; $accessToken = ($accessToken === 'Bearer') ? '' : $accessToken;
} elseif ($headersOnly === false) { } elseif ($headersOnly === false) {
$method = $this->getRequest()->server->get('REQUEST_METHOD');
$accessToken = $this->getRequest()->request->get($this->tokenKey); $accessToken = $this->getRequest()->request->get($this->tokenKey);
} }