public function testGetTokenControllerAccessTokenStorageAndClientCredentialsStorageAndGrantTypes() { $server = new Server(); $server->addStorage($this->getMock('OAuth2\\Storage\\AccessTokenInterface')); $server->addStorage($this->getMock('OAuth2\\Storage\\ClientCredentialsInterface')); $server->addGrantType($this->getMockBuilder('OAuth2\\GrantType\\AuthorizationCode')->disableOriginalConstructor()->getMock()); $server->getTokenController(); }
public function testUsingOpenIDConnectWithOpenIDAuthorizationCodeStorageCreatesOpenIDAuthorizationCodeGrantType() { $client = $this->getMock('OAuth2\\Storage\\ClientCredentialsInterface'); $userclaims = $this->getMock('OAuth2\\OpenID\\Storage\\UserClaimsInterface'); $pubkey = $this->getMock('OAuth2\\Storage\\PublicKeyInterface'); $token = $this->getMock('OAuth2\\Storage\\AccessTokenInterface'); $authcode = $this->getMock('OAuth2\\OpenID\\Storage\\AuthorizationCodeInterface'); $server = new Server(array($client, $userclaims, $pubkey, $token, $authcode), array('use_openid_connect' => true, 'issuer' => 'someguy')); $server->getTokenController(); $this->assertInstanceOf('OAuth2\\OpenID\\GrantType\\AuthorizationCode', $server->getGrantType('authorization_code')); }
public function testHttpBasicConfig() { // create mock storage $storage = Bootstrap::getInstance()->getMemoryStorage(); $server = new Server(array($storage), array('allow_credentials_in_request_body' => false)); $server->getTokenController(); $httpBasic = $server->getClientAssertionType(); $reflection = new \ReflectionClass($httpBasic); $prop = $reflection->getProperty('config'); $prop->setAccessible(true); $config = $prop->getValue($httpBasic); // get the private "storages" property $this->assertEquals($config['allow_credentials_in_request_body'], false); }