aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/RefreshToken.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/RefreshToken.php')
-rw-r--r--vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/RefreshToken.php63
1 files changed, 53 insertions, 10 deletions
diff --git a/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/RefreshToken.php b/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/RefreshToken.php
index e55385222..75c611f1d 100644
--- a/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/RefreshToken.php
+++ b/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/RefreshToken.php
@@ -8,25 +8,34 @@ use OAuth2\RequestInterface;
use OAuth2\ResponseInterface;
/**
- *
* @author Brent Shaffer <bshafs at gmail dot com>
*/
class RefreshToken implements GrantTypeInterface
{
+ /**
+ * @var array
+ */
private $refreshToken;
+ /**
+ * @var RefreshTokenInterface
+ */
protected $storage;
+
+ /**
+ * @var array
+ */
protected $config;
/**
- * @param OAuth2\Storage\RefreshTokenInterface $storage REQUIRED Storage class for retrieving refresh token information
- * @param array $config OPTIONAL Configuration options for the server
- * <code>
- * $config = array(
- * 'always_issue_new_refresh_token' => true, // whether to issue a new refresh token upon successful token request
- * 'unset_refresh_token_after_use' => true // whether to unset the refresh token after after using
- * );
- * </code>
+ * @param RefreshTokenInterface $storage - REQUIRED Storage class for retrieving refresh token information
+ * @param array $config - OPTIONAL Configuration options for the server
+ * @code
+ * $config = array(
+ * 'always_issue_new_refresh_token' => true, // whether to issue a new refresh token upon successful token request
+ * 'unset_refresh_token_after_use' => true // whether to unset the refresh token after after using
+ * );
+ * @endcode
*/
public function __construct(RefreshTokenInterface $storage, $config = array())
{
@@ -45,11 +54,21 @@ class RefreshToken implements GrantTypeInterface
$this->storage = $storage;
}
- public function getQuerystringIdentifier()
+ /**
+ * @return string
+ */
+ public function getQueryStringIdentifier()
{
return 'refresh_token';
}
+ /**
+ * Validate the OAuth request
+ *
+ * @param RequestInterface $request
+ * @param ResponseInterface $response
+ * @return bool|mixed|null
+ */
public function validateRequest(RequestInterface $request, ResponseInterface $response)
{
if (!$request->request("refresh_token")) {
@@ -76,21 +95,45 @@ class RefreshToken implements GrantTypeInterface
return true;
}
+ /**
+ * Get client id
+ *
+ * @return mixed
+ */
public function getClientId()
{
return $this->refreshToken['client_id'];
}
+ /**
+ * Get user id
+ *
+ * @return mixed|null
+ */
public function getUserId()
{
return isset($this->refreshToken['user_id']) ? $this->refreshToken['user_id'] : null;
}
+ /**
+ * Get scope
+ *
+ * @return null|string
+ */
public function getScope()
{
return isset($this->refreshToken['scope']) ? $this->refreshToken['scope'] : null;
}
+ /**
+ * Create access token
+ *
+ * @param AccessTokenInterface $accessToken
+ * @param mixed $client_id - client identifier related to the access token.
+ * @param mixed $user_id - user id associated with the access token
+ * @param string $scope - scopes to be stored in space-separated string.
+ * @return array
+ */
public function createAccessToken(AccessTokenInterface $accessToken, $client_id, $user_id, $scope)
{
/*