本文整理汇总了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();
}
}
示例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;
}
示例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;
}
示例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'));
}
示例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;
}
示例6: testAddingUnknownResponseTypeThrowsException
/**
* @expectedException InvalidArgumentException OAuth2\ResponseType\AuthorizationCodeInterface
**/
public function testAddingUnknownResponseTypeThrowsException()
{
$server = new Server();
$server->addResponseType($this->getMock('OAuth2\\ResponseType\\ResponseTypeInterface'));
}