aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/JwtBearer.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-12-18 15:48:49 +0100
committerMario Vavti <mario@mariovavti.com>2017-12-18 15:48:49 +0100
commit439d41b194073285ab97be94253b3f4cb4395e43 (patch)
tree272d4c64ea2d766235ecb41009117b5269f8cdfd /vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/JwtBearer.php
parent08a8f195e749a120642f6c486c1dad62a73924d1 (diff)
downloadvolse-hubzilla-439d41b194073285ab97be94253b3f4cb4395e43.tar.gz
volse-hubzilla-439d41b194073285ab97be94253b3f4cb4395e43.tar.bz2
volse-hubzilla-439d41b194073285ab97be94253b3f4cb4395e43.zip
install smarty via composer and update other php libs
Diffstat (limited to 'vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/JwtBearer.php')
-rw-r--r--vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/JwtBearer.php47
1 files changed, 34 insertions, 13 deletions
diff --git a/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/JwtBearer.php b/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/JwtBearer.php
index bb11a6954..62c1efabd 100644
--- a/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/JwtBearer.php
+++ b/vendor/bshaffer/oauth2-server-php/src/OAuth2/GrantType/JwtBearer.php
@@ -30,10 +30,12 @@ class JwtBearer implements GrantTypeInterface, ClientAssertionTypeInterface
/**
* Creates an instance of the JWT bearer grant type.
*
- * @param OAuth2\Storage\JWTBearerInterface|JwtBearerInterface $storage A valid storage interface that implements storage hooks for the JWT bearer grant type.
- * @param string $audience The audience to validate the token against. This is usually the full URI of the OAuth token requests endpoint.
- * @param EncryptionInterface|OAuth2\Encryption\JWT $jwtUtil OPTONAL The class used to decode, encode and verify JWTs.
- * @param array $config
+ * @param JwtBearerInterface $storage - A valid storage interface that implements storage hooks for the JWT
+ * bearer grant type.
+ * @param string $audience - The audience to validate the token against. This is usually the full
+ * URI of the OAuth token requests endpoint.
+ * @param EncryptionInterface|JWT $jwtUtil - OPTONAL The class used to decode, encode and verify JWTs.
+ * @param array $config
*/
public function __construct(JwtBearerInterface $storage, $audience, EncryptionInterface $jwtUtil = null, array $config = array())
{
@@ -56,12 +58,11 @@ class JwtBearer implements GrantTypeInterface, ClientAssertionTypeInterface
/**
* Returns the grant_type get parameter to identify the grant type request as JWT bearer authorization grant.
*
- * @return
- * The string identifier for grant_type.
+ * @return string - The string identifier for grant_type.
*
- * @see OAuth2\GrantType\GrantTypeInterface::getQuerystringIdentifier()
+ * @see GrantTypeInterface::getQueryStringIdentifier()
*/
- public function getQuerystringIdentifier()
+ public function getQueryStringIdentifier()
{
return 'urn:ietf:params:oauth:grant-type:jwt-bearer';
}
@@ -69,10 +70,9 @@ class JwtBearer implements GrantTypeInterface, ClientAssertionTypeInterface
/**
* Validates the data from the decoded JWT.
*
- * @return
- * TRUE if the JWT request is valid and can be decoded. Otherwise, FALSE is returned.
- *
- * @see OAuth2\GrantType\GrantTypeInterface::getTokenData()
+ * @param RequestInterface $request
+ * @param ResponseInterface $response
+ * @return bool|mixed|null TRUE if the JWT request is valid and can be decoded. Otherwise, FALSE is returned.@see GrantTypeInterface::getTokenData()
*/
public function validateRequest(RequestInterface $request, ResponseInterface $response)
{
@@ -196,16 +196,31 @@ class JwtBearer implements GrantTypeInterface, ClientAssertionTypeInterface
return true;
}
+ /**
+ * Get client id
+ *
+ * @return mixed
+ */
public function getClientId()
{
return $this->jwt['iss'];
}
+ /**
+ * Get user id
+ *
+ * @return mixed
+ */
public function getUserId()
{
return $this->jwt['sub'];
}
+ /**
+ * Get scope
+ *
+ * @return null
+ */
public function getScope()
{
return null;
@@ -215,7 +230,13 @@ class JwtBearer implements GrantTypeInterface, ClientAssertionTypeInterface
* Creates an access token that is NOT associated with a refresh token.
* If a subject (sub) the name of the user/account we are accessing data on behalf of.
*
- * @see OAuth2\GrantType\GrantTypeInterface::createAccessToken()
+ * @see GrantTypeInterface::createAccessToken()
+ *
+ * @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)
{