Esempio n. 1
1
 private function createCassandraDb(Cassandra $storage)
 {
     // create the cassandra keyspace and column family
     $sys = new \phpcassa\SystemManager('localhost:9160');
     $sys->create_keyspace('oauth2_test', array("strategy_class" => \phpcassa\Schema\StrategyClass::SIMPLE_STRATEGY, "strategy_options" => array('replication_factor' => '1')));
     $sys->create_column_family('oauth2_test', 'auth');
     $cassandra = new \phpcassa\Connection\ConnectionPool('oauth2_test', array('127.0.0.1:9160'));
     $cf = new \phpcassa\ColumnFamily($cassandra, 'auth');
     // populate the data
     $storage->setClientDetails("oauth_test_client", "testpass", "http://example.com", 'implicit password');
     $storage->setAccessToken("testtoken", "Some Client", '', time() + 1000);
     $storage->setAuthorizationCode("testcode", "Some Client", '', '', time() + 1000);
     $storage->setScope('supportedscope1 supportedscope2 supportedscope3 supportedscope4');
     $storage->setScope('defaultscope1 defaultscope2', null, 'default');
     $storage->setScope('clientscope1 clientscope2', 'Test Client ID');
     $storage->setScope('clientscope1 clientscope2', 'Test Client ID', 'default');
     $storage->setScope('clientscope1 clientscope2 clientscope3', 'Test Client ID 2');
     $storage->setScope('clientscope1 clientscope2', 'Test Client ID 2', 'default');
     $storage->setScope('clientscope1 clientscope2', 'Test Default Scope Client ID');
     $storage->setScope('clientscope1 clientscope2', 'Test Default Scope Client ID', 'default');
     $storage->setScope('clientscope1 clientscope2 clientscope3', 'Test Default Scope Client ID 2');
     $storage->setScope('clientscope3', 'Test Default Scope Client ID 2', 'default');
     $storage->setClientKey('oauth_test_client', $this->getTestPublicKey(), 'test_subject');
     $cf->insert("oauth_public_keys:ClientID_One", array('__data' => json_encode(array("public_key" => "client_1_public", "private_key" => "client_1_private", "encryption_algorithm" => "RS256"))));
     $cf->insert("oauth_public_keys:ClientID_Two", array('__data' => json_encode(array("public_key" => "client_2_public", "private_key" => "client_2_private", "encryption_algorithm" => "RS256"))));
     $cf->insert("oauth_public_keys:", array('__data' => json_encode(array("public_key" => $this->getTestPublicKey(), "private_key" => $this->getTestPrivateKey(), "encryption_algorithm" => "RS256"))));
     $cf->insert("oauth_users:testuser", array('__data' => json_encode(array("password" => "password", "email" => "*****@*****.**", "email_verified" => true))));
 }
Esempio n. 2
0
 private function createCassandraDb(Cassandra $storage)
 {
     // create the cassandra keyspace and column family
     $sys = new \phpcassa\SystemManager('localhost:9160');
     $sys->create_keyspace('oauth2_test', array("strategy_class" => \phpcassa\Schema\StrategyClass::SIMPLE_STRATEGY, "strategy_options" => array('replication_factor' => '1')));
     $sys->create_column_family('oauth2_test', 'auth');
     // populate the data
     $storage->setClientDetails("oauth_test_client", "testpass", "http://example.com", 'implicit password');
     $storage->setAccessToken("testtoken", "Some Client", '', time() + 1000);
     $storage->setAuthorizationCode("testcode", "Some Client", '', '', time() + 1000);
     $storage->setUser("testuser", "password");
     $storage->setScope('supportedscope1 supportedscope2 supportedscope3 supportedscope4');
     $storage->setScope('defaultscope1 defaultscope2', null, 'default');
     $storage->setScope('clientscope1 clientscope2', 'Test Client ID');
     $storage->setScope('clientscope1 clientscope2', 'Test Client ID', 'default');
     $storage->setScope('clientscope1 clientscope2 clientscope3', 'Test Client ID 2');
     $storage->setScope('clientscope1 clientscope2', 'Test Client ID 2', 'default');
     $storage->setScope('clientscope1 clientscope2', 'Test Default Scope Client ID');
     $storage->setScope('clientscope1 clientscope2', 'Test Default Scope Client ID', 'default');
     $storage->setScope('clientscope1 clientscope2 clientscope3', 'Test Default Scope Client ID 2');
     $storage->setScope('clientscope3', 'Test Default Scope Client ID 2', 'default');
     $storage->setClientKey('oauth_test_client', $this->getTestPublicKey(), 'test_subject');
 }