\OAuth2\GrantTypeJwtBearer

The JWT bearer authorization grant implements JWT (JSON Web Tokens) as a grant type per the IETF draft.

Summary

Methods
Properties
Constants
__construct()
getQueryStringIdentifier()
validateRequest()
getClientId()
getUserId()
getScope()
createAccessToken()
No public properties found
No constants found
No protected methods found
$storage
$audience
$jwtUtil
$allowedAlgorithms
N/A
No private methods found
$jwt
N/A

Properties

$storage

$storage : 

Type

$audience

$audience : 

Type

$jwtUtil

$jwtUtil : 

Type

$allowedAlgorithms

$allowedAlgorithms : 

Type

$jwt

$jwt : 

Type

Methods

__construct()

__construct(\OAuth2\Storage\JwtBearerInterface  $storage, string  $audience, \OAuth2\Encryption\EncryptionInterface|\OAuth2\GrantType\JWT  $jwtUtil = null, array  $config = array()) 

Creates an instance of the JWT bearer grant type.

Parameters

\OAuth2\Storage\JwtBearerInterface $storage
  • A valid storage interface that implements storage hooks for the JWT bearer grant type.
string $audience
  • The audience to validate the token against. This is usually the full URI of the OAuth token requests endpoint.
\OAuth2\Encryption\EncryptionInterface|\OAuth2\GrantType\JWT $jwtUtil
  • OPTONAL The class used to decode, encode and verify JWTs.
array $config

getQueryStringIdentifier()

getQueryStringIdentifier() : string

Returns the grant_type get parameter to identify the grant type request as JWT bearer authorization grant.

Returns

string —
  • The string identifier for grant_type.

validateRequest()

validateRequest(\OAuth2\RequestInterface  $request, \OAuth2\ResponseInterface  $response) : boolean|mixed|null

Validates the data from the decoded JWT.

Parameters

\OAuth2\RequestInterface $request
\OAuth2\ResponseInterface $response

Returns

boolean|mixed|null —

TRUE if the JWT request is valid and can be decoded. Otherwise, FALSE is returned.@see GrantTypeInterface::getTokenData()

getClientId()

getClientId() : mixed

Get client id

Returns

mixed

getUserId()

getUserId() : mixed

Get user id

Returns

mixed

getScope()

getScope() : null

Get scope

Returns

null

createAccessToken()

createAccessToken(\OAuth2\ResponseType\AccessTokenInterface  $accessToken, mixed  $client_id, mixed  $user_id, string  $scope) : array

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.

Parameters

\OAuth2\ResponseType\AccessTokenInterface $accessToken
mixed $client_id
  • client identifier related to the access token.
mixed $user_id
  • user id associated with the access token
string $scope
  • scopes to be stored in space-separated string.

Returns

array