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


PHP Server::addResponseType方法代码示例

本文整理汇总了PHP中OAuth2\Server::addResponseType方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::addResponseType方法的具体用法?PHP Server::addResponseType怎么用?PHP Server::addResponseType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OAuth2\Server的用法示例。


在下文中一共展示了Server::addResponseType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: middleware

 public function middleware($req, $res)
 {
     $this->app['oauth_server'] = function ($c) {
         $storage = new IdealistStorage();
         $storage->injectApp($c);
         $server = new Server($storage);
         // password grant type
         $grantType = new UserCredentials($storage);
         $server->addGrantType($grantType);
         // JWT access token response type
         $config = $c['config']->get('oauth2');
         $jwtResponseType = new JwtAccessToken($storage, $storage, null, $config);
         $server->addResponseType($jwtResponseType);
         return $server;
     };
     $this->app['oauth_resource'] = function ($c) {
         $server = new Server();
         // no private key is necessary for the resource server
         $keyStorage = new Memory(['keys' => ['public_key' => file_get_contents(INFUSE_BASE_DIR . '/jwt_pubkey.pem')]]);
         $storage = new JwtAccessTokenStorage($keyStorage);
         $server->addStorage($storage, 'access_token');
         return $server;
     };
     // attempt to authenticate the user when an API request is made
     if ($req->isApi()) {
         $this->authenticateApiRequest();
     }
 }
开发者ID:idealistsoft,项目名称:framework-oauth2,代码行数:28,代码来源:Controller.php

示例2: getTestServer

 private function getTestServer()
 {
     $memoryStorage = Bootstrap::getInstance()->getMemoryStorage();
     $storage = array('access_token' => new CryptoTokenStorage($memoryStorage), 'client' => $memoryStorage, 'client_credentials' => $memoryStorage);
     $server = new Server($storage);
     $server->addGrantType(new ClientCredentials($memoryStorage));
     // make the "token" response type a CryptoToken
     $server->addResponseType(new CryptoToken($memoryStorage, $memoryStorage));
     return $server;
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:10,代码来源:CryptoTokenTest.php

示例3: getTestServer

 private function getTestServer()
 {
     $memoryStorage = Bootstrap::getInstance()->getMemoryStorage();
     $storage = array('access_token' => $memoryStorage, 'client' => $memoryStorage, 'device_code' => $memoryStorage);
     $server = new Server($storage);
     // make the "token" response type a DeviceCode response type
     $config = array('interval' => 5, 'verification_uri' => 'http://mysite.com/device');
     $rsp = new DeviceCodeResponseType($memoryStorage, $config);
     $server->addResponseType($rsp);
     return $server;
 }
开发者ID:TroRg,项目名称:oauth2-server-php,代码行数:11,代码来源:DeviceCodeTest.php

示例4: testUsingOpenIDConnectWithAllowImplicitAndAccessTokenResponseTypeIsOkay

 public function testUsingOpenIDConnectWithAllowImplicitAndAccessTokenResponseTypeIsOkay()
 {
     $client = $this->getMock('OAuth2\\Storage\\ClientInterface');
     $userclaims = $this->getMock('OAuth2\\OpenID\\Storage\\UserClaimsInterface');
     $pubkey = $this->getMock('OAuth2\\Storage\\PublicKeyInterface');
     // $token = $this->getMock('OAuth2\Storage\AccessTokenInterface');
     $server = new Server(array($client, $userclaims, $pubkey), array('use_openid_connect' => true, 'issuer' => 'someguy', 'allow_implicit' => true));
     $token = $this->getMock('OAuth2\\ResponseType\\AccessTokenInterface');
     $server->addResponseType($token, 'token');
     $server->getAuthorizeController();
     $this->assertInstanceOf('OAuth2\\OpenID\\ResponseType\\IdTokenInterface', $server->getResponseType('id_token'));
     $this->assertInstanceOf('OAuth2\\OpenID\\ResponseType\\IdTokenTokenInterface', $server->getResponseType('id_token token'));
 }
开发者ID:huangzhwork,项目名称:oauth2-server-php,代码行数:13,代码来源:ServerTest.php

示例5: getTestServer

 private function getTestServer()
 {
     $memoryStorage = Bootstrap::getInstance()->getMemoryStorage();
     $storage = array('access_token' => new JwtAccessTokenStorage($memoryStorage), 'client' => $memoryStorage, 'client_credentials' => $memoryStorage);
     $server = new Server($storage);
     $server->addGrantType(new ClientCredentials($memoryStorage));
     // make the "token" response type a JwtAccessToken
     $config = array('issuer' => 'https://api.example.com');
     $server->addResponseType(new JwtAccessToken($memoryStorage, $memoryStorage, null, $config));
     return $server;
 }
开发者ID:huangzhwork,项目名称:oauth2-server-php,代码行数:11,代码来源:JwtAccessTokenTest.php

示例6: testAddingUnknownResponseTypeThrowsException

 /**
  * @expectedException InvalidArgumentException OAuth2\ResponseType\AuthorizationCodeInterface
  **/
 public function testAddingUnknownResponseTypeThrowsException()
 {
     $server = new Server();
     $server->addResponseType($this->getMock('OAuth2\\ResponseType\\ResponseTypeInterface'));
 }
开发者ID:sarfraznawaz2005,项目名称:sso-examples,代码行数:8,代码来源:ServerTest.php


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