本文整理汇总了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();
}