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