TokenControllerInterface.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace OAuth2\Controller;
  3. use OAuth2\RequestInterface;
  4. use OAuth2\ResponseInterface;
  5. /**
  6. * This controller is called when a token is being requested.
  7. * it is called to handle all grant types the application supports.
  8. * It also validates the client's credentials
  9. *
  10. * @code
  11. * $tokenController->handleTokenRequest(OAuth2\Request::createFromGlobals(), $response = new OAuth2\Response());
  12. * $response->send();
  13. * @endcode
  14. */
  15. interface TokenControllerInterface
  16. {
  17. /**
  18. * Handle the token request
  19. *
  20. * @param RequestInterface $request - The current http request
  21. * @param ResponseInterface $response - An instance of OAuth2\ResponseInterface to contain the response data
  22. */
  23. public function handleTokenRequest(RequestInterface $request, ResponseInterface $response);
  24. /**
  25. * Grant or deny a requested access token.
  26. * This would be called from the "/token" endpoint as defined in the spec.
  27. * You can call your endpoint whatever you want.
  28. *
  29. * @param RequestInterface $request - Request object to grant access token
  30. * @param ResponseInterface $response - Response object
  31. *
  32. * @return mixed
  33. */
  34. public function grantAccessToken(RequestInterface $request, ResponseInterface $response);
  35. }