コード例 #1
0
ファイル: Bootstrap.php プロジェクト: ppantilla/bbninja
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
 private function getTestServer()
 {
     $storage = OAuth2_Storage_Bootstrap::getInstance()->getMemoryStorage();
     $server = new OAuth2_Server($storage);
     $server->addGrantType(new OAuth2_GrantType_UserCredentials($storage));
     return $server;
 }
コード例 #3
0
 private function getTestServer()
 {
     $storage = OAuth2_Storage_Bootstrap::getInstance()->getMemoryStorage();
     $server = new OAuth2_Server($storage);
     $server->addGrantType(new OAuth2_GrantType_AuthorizationCode($storage));
     // or some other grant type.  This is the simplest
     return $server;
 }
コード例 #4
0
ファイル: RequestTest.php プロジェクト: ppantilla/bbninja
 private function getTestServer($config = array())
 {
     $storage = OAuth2_Storage_Bootstrap::getInstance()->getMemoryStorage();
     $server = new OAuth2_Server($storage, $config);
     // Add the two types supported for authorization grant
     $server->addGrantType(new OAuth2_GrantType_AuthorizationCode($storage));
     return $server;
 }
コード例 #5
0
 public function testCustomClientAssertionType()
 {
     $request = OAuth2_Request_TestRequest::createPost(array('grant_type' => 'authorization_code', 'client_id' => 'Test Client ID', 'code' => 'testcode'));
     // verify the mock clientAssertionType was called as expected
     $clientAssertionType = $this->getMock('OAuth2_ClientAssertionTypeInterface', array('validateRequest', 'getClientId'));
     $clientAssertionType->expects($this->once())->method('validateRequest')->will($this->returnValue(true));
     $clientAssertionType->expects($this->once())->method('getClientId')->will($this->returnValue('Test Client ID'));
     // create mock storage
     $storage = OAuth2_Storage_Bootstrap::getInstance()->getMemoryStorage();
     $server = new OAuth2_Server(array($storage), array(), array(), array(), null, null, $clientAssertionType);
     $server->handleTokenRequest($request, $response = new OAuth2_Response());
 }
コード例 #6
0
 public function provideStorage()
 {
     $memory = OAuth2_Storage_Bootstrap::getInstance()->getMemoryStorage();
     $mysql = OAuth2_Storage_Bootstrap::getInstance()->getMysqlPdo();
     $sqlite = OAuth2_Storage_Bootstrap::getInstance()->getSqlitePdo();
     $mongo = OAuth2_Storage_Bootstrap::getInstance()->getMongo();
     $redis = OAuth2_Storage_Bootstrap::getInstance()->getRedisStorage();
     // will add multiple storage types later
     return array(array($sqlite), array($mysql), array($mongo), array($redis));
 }
コード例 #7
0
 public function provideStorage()
 {
     $mysql = OAuth2_Storage_Bootstrap::getInstance()->getMysqlPdo();
     $sqlite = OAuth2_Storage_Bootstrap::getInstance()->getSqlitePdo();
     // will add multiple storage types later
     return array(array($sqlite), array($mysql));
 }
コード例 #8
0
 private function getTestServer($audience = 'http://myapp.com/oauth/auth')
 {
     $storage = OAuth2_Storage_Bootstrap::getInstance()->getMemoryStorage();
     $server = new OAuth2_Server($storage);
     $server->addGrantType(new OAuth2_GrantType_JWTBearer($storage, $audience));
     return $server;
 }
コード例 #9
0
 private function getTestServer()
 {
     $this->storage = OAuth2_Storage_Bootstrap::getInstance()->getMemoryStorage();
     $server = new OAuth2_Server($this->storage);
     return $server;
 }