本文整理匯總了PHP中OAuth2\Server::getResourceController方法的典型用法代碼示例。如果您正苦於以下問題:PHP Server::getResourceController方法的具體用法?PHP Server::getResourceController怎麽用?PHP Server::getResourceController使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OAuth2\Server
的用法示例。
在下文中一共展示了Server::getResourceController方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __invoke
/**
* Execute this middleware.
*
* @param ServerRequestInterface $request The PSR7 request.
* @param ResponseInterface $response The PSR7 response.
* @param callable $next The Next middleware.
*
* @return ResponseInterface
*/
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
{
$oauth2Request = RequestBridge::toOAuth2($request);
foreach ($this->scopes as $scope) {
if ($this->server->verifyResourceRequest($oauth2Request, null, $scope)) {
$this->container['token'] = $this->server->getResourceController()->getToken();
return $next($request, $response);
}
}
return ResponseBridge::fromOAuth2($this->server->getResponse());
}
示例2: call
/**
* Verify request contains valid access token.
*
* @param array $scopes Scopes required for authorization. $scopes can be given as an array of arrays. OR logic will
* use with each grouping. Example: Given ['superUser', ['basicUser', 'aPermission']], the
* request will be verified if the request token has 'superUser' scope OR 'basicUser' and
* 'aPermission' as its scope
*
* @return void
*/
public function call(array $scopes = [null])
{
if (!$this->verify($scopes)) {
MessageBridge::mapResponse($this->server->getResponse(), $this->app->response());
$this->app->stop();
}
//@codeCoverageIgnore since stop() throws
$this->app->token = $this->server->getResourceController()->getToken();
if ($this->next !== null) {
$this->next->call();
}
}
示例3: testUsingJustJwtAccessTokenStorageWithResourceControllerIsOkay
public function testUsingJustJwtAccessTokenStorageWithResourceControllerIsOkay()
{
$pubkey = $this->getMock('OAuth2\\Storage\\PublicKeyInterface');
$server = new Server(array($pubkey), array('use_jwt_access_tokens' => true));
$this->assertNotNull($server->getResourceController());
$this->assertInstanceOf('OAuth2\\Storage\\PublicKeyInterface', $server->getStorage('public_key'));
}
示例4: testGetResourceControllerWithAccessTokenStorage
public function testGetResourceControllerWithAccessTokenStorage()
{
$server = new Server();
$server->addStorage($this->getMock('OAuth2\\Storage\\AccessTokenInterface'));
$server->getResourceController();
}