mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-02 00:43:11 +05:30
Adding a few Getters to the Resource, moving Exceptions and adding some new ones.
This commit is contained in:
parent
c12472857b
commit
2727ba0078
8
src/OAuth2/Exception/InvalidGrantTypeException.php
Normal file
8
src/OAuth2/Exception/InvalidGrantTypeException.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace OAuth2\Exception;
|
||||
|
||||
class InvalidGrantTypeException extends OAuth2Exception
|
||||
{
|
||||
|
||||
}
|
8
src/OAuth2/Exception/MissingAccessTokenException.php
Normal file
8
src/OAuth2/Exception/MissingAccessTokenException.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace OAuth2\Exception;
|
||||
|
||||
class MissingAccessTokenException extends OAuth2Exception
|
||||
{
|
||||
|
||||
}
|
8
src/OAuth2/Exception/OAuth2Exception.php
Normal file
8
src/OAuth2/Exception/OAuth2Exception.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace OAuth2\Exception;
|
||||
|
||||
class OAuth2Exception extends \Exception
|
||||
{
|
||||
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace OAuth2;
|
||||
|
||||
class MissingAccessTokenException extends \Exception
|
||||
{
|
||||
|
||||
}
|
@ -60,6 +60,26 @@ class Resource
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Owner ID.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getOwnerId()
|
||||
{
|
||||
return $this->ownerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Owner Type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOwnerType()
|
||||
{
|
||||
return $this->ownerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the Access Token is valid or not.
|
||||
*
|
||||
@ -113,7 +133,7 @@ class Resource
|
||||
* Reads in the Access Token from the headers.
|
||||
*
|
||||
* @return string
|
||||
* @throws MissingAccessTokenException
|
||||
* @throws Exception\MissingAccessTokenException
|
||||
*/
|
||||
protected function determineAccessToken()
|
||||
{
|
||||
@ -125,7 +145,7 @@ class Resource
|
||||
}
|
||||
|
||||
if (empty($access_token)) {
|
||||
throw new MissingAccessTokenException('Access Token is Missing');
|
||||
throw new Exception\MissingAccessTokenException('Access Token is Missing');
|
||||
}
|
||||
|
||||
return $access_token;
|
||||
|
Loading…
Reference in New Issue
Block a user