Inheritance: implements fkooman\OAuth\Client\ClientConfigInterface
 public function __construct(array $data)
 {
     foreach (array('client_id', 'client_secret') as $key) {
         if (!isset($data[$key])) {
             throw new ClientConfigException(sprintf("missing field '%s'", $key));
         }
     }
     $clientData = array("client_id" => $data['client_id'], "client_secret" => $data['client_secret'], "authorize_endpoint" => "https://github.com/login/oauth/authorize", "token_endpoint" => "https://github.com/login/oauth/access_token", "use_comma_separated_scope" => true, "credentials_in_request_body" => true);
     parent::__construct($clientData);
 }
 public function __construct(array $data)
 {
     if (!isset($data['shopify'])) {
         throw new ClientConfigException("no configuration 'shopify' found");
     }
     foreach (array('client_id', 'client_secret', 'shopname', 'redirect_uri') as $key) {
         if (!isset($data['shopify'][$key])) {
             throw new ClientConfigException(sprintf("missing field '%s'", $key));
         }
     }
     $clientData = array('client_id' => $data['shopify']['client_id'], 'client_secret' => $data['shopify']['client_secret'], 'authorize_endpoint' => "https://{$data['shopify']['shopname']}.myshopify.com/admin/oauth/authorize", 'token_endpoint' => "https://{$data['shopify']['shopname']}.myshopify.com/admin/oauth/access_token", 'redirect_uri' => $data['shopify']['redirect_uri'], 'credentials_in_request_body' => true, 'use_comma_separated_scope' => true, 'default_token_type' => 'bearer');
     parent::__construct($clientData);
 }
 public function testLessSimple()
 {
     $data = array('client_id' => 'foo', 'client_secret' => 'bar', 'authorize_endpoint' => 'http://www.example.org/authorize', 'token_endpoint' => 'http://www.example.org/token', 'redirect_uri' => 'http://www.example.org/callback', 'credentials_in_request_body' => true);
     $c = new ClientConfig($data);
     $this->assertEquals('foo', $c->getClientId());
     $this->assertEquals('bar', $c->getClientSecret());
     $this->assertEquals('http://www.example.org/authorize', $c->getAuthorizeEndpoint());
     $this->assertEquals('http://www.example.org/token', $c->getTokenEndpoint());
     $this->assertEquals('http://www.example.org/callback', $c->getRedirectUri());
     $this->assertTrue($c->getCredentialsInRequestBody());
 }
Exemple #4
0
 public function testLessSimple()
 {
     $data = array("client_id" => "foo", "client_secret" => "bar", "authorize_endpoint" => "http://www.example.org/authorize", "token_endpoint" => "http://www.example.org/token", "redirect_uri" => "http://www.example.org/callback", "credentials_in_request_body" => true);
     $c = new ClientConfig($data);
     $this->assertEquals("foo", $c->getClientId());
     $this->assertEquals("bar", $c->getClientSecret());
     $this->assertEquals("http://www.example.org/authorize", $c->getAuthorizeEndpoint());
     $this->assertEquals("http://www.example.org/token", $c->getTokenEndpoint());
     $this->assertEquals("http://www.example.org/callback", $c->getRedirectUri());
     $this->assertTrue($c->getCredentialsInRequestBody());
 }
 public function __construct(array $data)
 {
     // check if array is Google configuration object
     if (!isset($data['web'])) {
         throw new ClientConfigException("no configuration 'web' found, possibly wrong client type");
     }
     foreach (array('client_id', 'client_secret', 'auth_uri', 'token_uri', 'redirect_uris') as $key) {
         if (!isset($data['web'][$key])) {
             throw new ClientConfigException(sprintf("missing field '%s'", $key));
         }
     }
     // we map Google configuration to ClientConfig configuration
     $clientData = array("client_id" => $data['web']['client_id'], "client_secret" => $data['web']['client_secret'], "authorize_endpoint" => $data['web']['auth_uri'], "token_endpoint" => $data['web']['token_uri'], "redirect_uri" => $data['web']['redirect_uris'][0], "credentials_in_request_body" => true);
     parent::__construct($clientData);
 }
 public function __construct(array $data)
 {
     foreach (array('client_id', 'client_secret') as $key) {
         if (!isset($data[$key])) {
             throw new ClientConfigException(sprintf("missing field '%s'", $key));
         }
     }
     $this->user_info_endpoint = $data['user_info_endpoint'];
     $this->user_info_endpoint_method = strtolower($data['user_info_endpoint_method']);
     $this->plugin_folder = $data['plugin_folder'];
     $this->plugin_file = $data['plugin_file'];
     $this->style_url = isset($data['style_url']) ? $data['style_url'] : false;
     $this->scope = $data['scope'];
     parent::__construct($data);
 }
 public function __construct(array $data)
 {
     if (!isset($data)) {
         throw new ClientConfigException("no configuration found");
     }
     foreach (array('cw.client_id', 'cw.client_secret', 'cw.endpoint_uri', 'cw.token_storage') as $key) {
         if (!isset($data[$key])) {
             throw new ClientConfigException(sprintf("missing field '%s'", $key));
         }
     }
     $this->baseUrl = $data['cw.endpoint_uri'];
     $this->storage = $data['cw.token_storage'];
     $clientData = array("client_id" => $data['cw.client_id'], "client_secret" => $data['cw.client_secret'], "token_endpoint" => $data['cw.endpoint_uri'] . '/oauth/token', "credentials_in_request_body" => true, "authorize_endpoint" => $data['cw.endpoint_uri']);
     parent::__construct($clientData);
 }