Cheetah
Public Member Functions | Protected Attributes | List of all members
OAuth2\Controller\TokenController Class Reference
Inheritance diagram for OAuth2\Controller\TokenController:
OAuth2\Controller\TokenControllerInterface

Public Member Functions

 __construct (AccessTokenInterface $accessToken, ClientInterface $clientStorage, array $grantTypes=array(), ClientAssertionTypeInterface $clientAssertionType=null, ScopeInterface $scopeUtil=null)
 
 handleTokenRequest (RequestInterface $request, ResponseInterface $response)
 
 grantAccessToken (RequestInterface $request, ResponseInterface $response)
 
 addGrantType (GrantTypeInterface $grantType, $identifier=null)
 
 handleRevokeRequest (RequestInterface $request, ResponseInterface $response)
 
 revokeToken (RequestInterface $request, ResponseInterface $response)
 

Protected Attributes

 $accessToken
 
 $grantTypes
 
 $clientAssertionType
 
 $scopeUtil
 
 $clientStorage
 

Detailed Description

See also
OAuth2\Controller\TokenControllerInterface

Definition at line 17 of file TokenController.php.

Constructor & Destructor Documentation

◆ __construct()

OAuth2\Controller\TokenController::__construct ( AccessTokenInterface  $accessToken,
ClientInterface  $clientStorage,
array  $grantTypes = array(),
ClientAssertionTypeInterface  $clientAssertionType = null,
ScopeInterface  $scopeUtil = null 
)

Definition at line 25 of file TokenController.php.

Member Function Documentation

◆ addGrantType()

OAuth2\Controller\TokenController::addGrantType ( GrantTypeInterface  $grantType,
  $identifier = null 
)

addGrantType

Parameters
grantType- OAuth2\GrantTypeInterface the grant type to add for the specified identifier
identifier- string a string passed in as "grant_type" in the response that will call this grantType

Definition at line 212 of file TokenController.php.

◆ grantAccessToken()

OAuth2\Controller\TokenController::grantAccessToken ( RequestInterface  $request,
ResponseInterface  $response 
)

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
$request- RequestInterface Request object to grant access token
Exceptions
InvalidArgumentException
LogicException
See also
http://tools.ietf.org/html/rfc6749#section-4
http://tools.ietf.org/html/rfc6749#section-10.6
http://tools.ietf.org/html/rfc6749#section-4.1.3

Determine grant type from request and validate the request for that grant type

Retrieve the client information from the request ClientAssertionTypes allow for grant types which also assert the client data in which case ClientAssertion is handled in the validateRequest method

See also
OAuth2\GrantType\JWTBearer
OAuth2\GrantType\ClientCredentials

Retrieve the grant type information from the request The GrantTypeInterface object handles all validation If the object is an instance of ClientAssertionTypeInterface, That logic is handled here as well

Validate the client can use the requested grant type

Validate the scope of the token

requestedScope - the scope specified in the token request availableScope - the scope associated with the grant type ex: in the case of the "Authorization Code" grant type, the scope is specified in the authorize request

See also
http://tools.ietf.org/html/rfc6749#section-3.3

Implements OAuth2\Controller\TokenControllerInterface.

Definition at line 75 of file TokenController.php.

◆ handleRevokeRequest()

OAuth2\Controller\TokenController::handleRevokeRequest ( RequestInterface  $request,
ResponseInterface  $response 
)

Definition at line 221 of file TokenController.php.

◆ handleTokenRequest()

OAuth2\Controller\TokenController::handleTokenRequest ( RequestInterface  $request,
ResponseInterface  $response 
)

handleTokenRequest

Parameters
$requestOAuth2\RequestInterface - The current http request
$responseOAuth2\ResponseInterface - An instance of OAuth2\ResponseInterface to contain the response data

Implements OAuth2\Controller\TokenControllerInterface.

Definition at line 47 of file TokenController.php.

◆ revokeToken()

OAuth2\Controller\TokenController::revokeToken ( RequestInterface  $request,
ResponseInterface  $response 
)

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
RequestInterface$request
ResponseInterface$response
Returns
bool|null

Definition at line 241 of file TokenController.php.

Member Data Documentation

◆ $accessToken

OAuth2\Controller\TokenController::$accessToken
protected

Definition at line 19 of file TokenController.php.

◆ $clientAssertionType

OAuth2\Controller\TokenController::$clientAssertionType
protected

Definition at line 21 of file TokenController.php.

◆ $clientStorage

OAuth2\Controller\TokenController::$clientStorage
protected

Definition at line 23 of file TokenController.php.

◆ $grantTypes

OAuth2\Controller\TokenController::$grantTypes
protected

Definition at line 20 of file TokenController.php.

◆ $scopeUtil

OAuth2\Controller\TokenController::$scopeUtil
protected

Definition at line 22 of file TokenController.php.


The documentation for this class was generated from the following file: