mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 17:56:14 +05:30
Changed variable syntax style to be PSR2
This commit is contained in:
parent
acfadc8993
commit
6897e233d4
@ -163,15 +163,15 @@ class ResourceServer
|
|||||||
*/
|
*/
|
||||||
public function isValid()
|
public function isValid()
|
||||||
{
|
{
|
||||||
$access_token = $this->determineAccessToken();
|
$accessToken = $this->determineAccessToken();
|
||||||
|
|
||||||
$result = $this->storages['session']->validateAccessToken($access_token);
|
$result = $this->storages['session']->validateAccessToken($accessToken);
|
||||||
|
|
||||||
if ( ! $result) {
|
if ( ! $result) {
|
||||||
throw new Exception\InvalidAccessTokenException('Access token is not valid');
|
throw new Exception\InvalidAccessTokenException('Access token is not valid');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->accessToken = $access_token;
|
$this->accessToken = $accessToken;
|
||||||
$this->sessionId = $result['id'];
|
$this->sessionId = $result['id'];
|
||||||
$this->ownerType = $result['owner_type'];
|
$this->ownerType = $result['owner_type'];
|
||||||
$this->ownerId = $result['owner_id'];
|
$this->ownerId = $result['owner_id'];
|
||||||
@ -215,17 +215,17 @@ class ResourceServer
|
|||||||
protected function determineAccessToken()
|
protected function determineAccessToken()
|
||||||
{
|
{
|
||||||
if ($header = $this->getRequest()->header('Authorization')) {
|
if ($header = $this->getRequest()->header('Authorization')) {
|
||||||
$access_token = trim(str_replace('Bearer', '', $header));
|
$accessToken = trim(str_replace('Bearer', '', $header));
|
||||||
} else {
|
} else {
|
||||||
$method = $this->getRequest()->server('REQUEST_METHOD');
|
$method = $this->getRequest()->server('REQUEST_METHOD');
|
||||||
$access_token = $this->getRequest()->{$method}($this->tokenKey);
|
$accessToken = $this->getRequest()->{$method}($this->tokenKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($access_token)) {
|
if (empty($accessToken)) {
|
||||||
throw new Exception\InvalidAccessTokenException('Access token is missing');
|
throw new Exception\InvalidAccessTokenException('Access token is missing');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $access_token;
|
return $accessToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user