public function setUp()
 {
     parent::setUp();
     $oauthStorageBackend = 'OAuth\\' . $this->_config->getValue('storageBackend');
     $storage = new $oauthStorageBackend($this->_config);
     $resourceOwnerOne = array("id" => "fkooman", "entitlement" => array("urn:x-foo:service:access", "urn:x-bar:privilege:admin"), "ext" => array());
     $resourceOwnerTwo = array("id" => "frko", "entitlement" => array(), "ext" => array());
     $storage->updateResourceOwner(new MockResourceOwner($resourceOwnerOne));
     $storage->updateResourceOwner(new MockResourceOwner($resourceOwnerTwo));
     $storage->storeAccessToken("foo", time(), "testclient", "fkooman", "foo bar", 1234);
     $storage->storeAccessToken("bar", time(), "testclient", "frko", "a b c", 1234);
 }
Exemplo n.º 2
0
 public function setUp()
 {
     parent::setUp();
     // enable Api
     $this->_config->setSectionValue("Api", "enableApi", TRUE);
     $this->_api = new Api($this->_config, NULL);
     $oauthStorageBackend = 'OAuth\\' . $this->_config->getValue('storageBackend');
     $storage = new $oauthStorageBackend($this->_config);
     $resourceOwner = array("id" => "fkooman", "entitlement" => array(), "ext" => array());
     $storage->updateResourceOwner(new MockResourceOwner($resourceOwner));
     $storage->addApproval('testclient', 'fkooman', 'read', NULL);
     $storage->storeAccessToken('12345abc', time(), 'testcodeclient', 'fkooman', 'authorizations', 3600);
 }
 public function setUp()
 {
     parent::setUp();
     $oauthStorageBackend = 'OAuth\\' . $this->_config->getValue('storageBackend');
     $storage = new $oauthStorageBackend($this->_config);
     $resourceOwner = array("id" => "fkooman", "entitlement" => array(), "ext" => array());
     $storage->updateResourceOwner(new MockResourceOwner($resourceOwner));
     $storage->addApproval('testcodeclient', 'fkooman', 'read write foo', 'r3fr3sh');
     $storage->addApproval('testnativeclient', 'fkooman', 'read', 'n4t1v3r3fr3sh');
     $storage->storeAuthorizationCode("4uth0r1z4t10n", "fkooman", time(), "testcodeclient", NULL, "read");
     $storage->storeAuthorizationCode("3xp1r3d4uth0r1z4t10n", "fkooman", time() - 1000, "testcodeclient", NULL, "read");
     $storage->storeAuthorizationCode("n4t1v34uth0r1z4t10n", "fkooman", time(), "testnativeclient", NULL, "read");
     $storage->storeAuthorizationCode("authorizeRequestWithRedirectUri", "fkooman", time(), "testcodeclient", "http://localhost/php-oauth/unit/test.html", "read");
 }