ldap-matter/oauth/OAuth2/Controller/ResourceControllerInterface...

42 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2017-08-08 03:01:11 +08:00
<?php
namespace OAuth2\Controller;
use OAuth2\RequestInterface;
use OAuth2\ResponseInterface;
/**
* This controller is called when a "resource" is requested.
* call verifyResourceRequest in order to determine if the request
* contains a valid token.
*
2020-04-30 21:43:07 +08:00
* @code
* if (!$resourceController->verifyResourceRequest(OAuth2\Request::createFromGlobals(), $response = new OAuth2\Response())) {
* $response->send(); // authorization failed
* die();
* }
* return json_encode($resource); // valid token! Send the stuff!
* @endcode
2017-08-08 03:01:11 +08:00
*/
interface ResourceControllerInterface
{
2020-04-30 21:43:07 +08:00
/**
* Verify the resource request
*
* @param RequestInterface $request - Request object
* @param ResponseInterface $response - Response object
* @param string $scope
* @return mixed
*/
2017-08-08 03:01:11 +08:00
public function verifyResourceRequest(RequestInterface $request, ResponseInterface $response, $scope = null);
2020-04-30 21:43:07 +08:00
/**
* Get access token data.
*
* @param RequestInterface $request - Request object
* @param ResponseInterface $response - Response object
* @return mixed
*/
2017-08-08 03:01:11 +08:00
public function getAccessTokenData(RequestInterface $request, ResponseInterface $response);
}