当前位置: 首页>>代码示例>>PHP>>正文


PHP Server::getResourceController方法代码示例

本文整理汇总了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());
 }
开发者ID:chadicus,项目名称:slim-oauth2-middleware,代码行数:20,代码来源:Authorization.php

示例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();
     }
 }
开发者ID:salt-lick,项目名称:slim-oauth2-middleware,代码行数:22,代码来源:Authorization.php

示例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'));
 }
开发者ID:huangzhwork,项目名称:oauth2-server-php,代码行数:7,代码来源:ServerTest.php

示例4: testGetResourceControllerWithAccessTokenStorage

 public function testGetResourceControllerWithAccessTokenStorage()
 {
     $server = new Server();
     $server->addStorage($this->getMock('OAuth2\\Storage\\AccessTokenInterface'));
     $server->getResourceController();
 }
开发者ID:sarfraznawaz2005,项目名称:sso-examples,代码行数:6,代码来源:ServerTest.php


注:本文中的OAuth2\Server::getResourceController方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。