\OAuth2\ControllerTokenController

Summary

Methods
Properties
Constants
__construct()
handleTokenRequest()
grantAccessToken()
addGrantType()
handleRevokeRequest()
revokeToken()
No public properties found
No constants found
No protected methods found
$accessToken
$grantTypes
$clientAssertionType
$scopeUtil
$clientStorage
N/A
No private methods found
No private properties found
N/A

Properties

$grantTypes

$grantTypes : \OAuth2\Controller\array<GrantTypeInterface>

Type

\OAuth2\Controller\array

Methods

__construct()

__construct(\OAuth2\ResponseType\AccessTokenInterface  $accessToken, \OAuth2\Storage\ClientInterface  $clientStorage, array  $grantTypes = array(), \OAuth2\ClientAssertionType\ClientAssertionTypeInterface  $clientAssertionType = null, \OAuth2\ScopeInterface  $scopeUtil = null) 

Constructor

Parameters

\OAuth2\ResponseType\AccessTokenInterface $accessToken
\OAuth2\Storage\ClientInterface $clientStorage
array $grantTypes
\OAuth2\ClientAssertionType\ClientAssertionTypeInterface $clientAssertionType
\OAuth2\ScopeInterface $scopeUtil

Throws

\InvalidArgumentException

handleTokenRequest()

handleTokenRequest(\OAuth2\RequestInterface  $request, \OAuth2\ResponseInterface  $response) 

Handle the token request.

Parameters

\OAuth2\RequestInterface $request
  • Request object to grant access token
\OAuth2\ResponseInterface $response
  • Response object

grantAccessToken()

grantAccessToken(\OAuth2\RequestInterface  $request, \OAuth2\ResponseInterface  $response) : boolean|null|array

Grant or deny a requested access token.

This would be called from the "/token" endpoint as defined in the spec. You can call your endpoint whatever you want.

Parameters

\OAuth2\RequestInterface $request
  • Request object to grant access token
\OAuth2\ResponseInterface $response
  • Response object

Throws

\InvalidArgumentException
\LogicException

Returns

boolean|null|array

addGrantType()

addGrantType(\OAuth2\GrantType\GrantTypeInterface  $grantType, string|null  $identifier = null) 

Add grant type

Parameters

\OAuth2\GrantType\GrantTypeInterface $grantType
  • the grant type to add for the specified identifier
string|null $identifier
  • a string passed in as "grant_type" in the response that will call this grantType

revokeToken()

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

Revoke a refresh or access token. Returns true on success and when tokens are invalid

Note: invalid tokens do not cause an error response since the client cannot handle such an error in a reasonable way. Moreover, the purpose of the revocation request, invalidating the particular token, is already achieved.

Parameters

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

Throws

\RuntimeException

Returns

boolean|null