Example #1
0
 public function testCreateAdapterByItsClass()
 {
     $di = DI::getDefault();
     $oauth = new OAuth($di);
     $linkedin = new \Vegas\Security\OAuth\Service\Linkedin($di, $oauth->getDefaultSessionStorage());
     $this->assertInstanceOf('\\Vegas\\Security\\OAuth\\Service\\Linkedin', $linkedin);
 }
Example #2
0
 /**
  * Setups oAuth services from configuration
  */
 protected function setupServices()
 {
     $this->oAuth = new \Vegas\Security\OAuth($this->di);
     foreach ($this->config as $serviceName => $serviceConfig) {
         $service = $this->oAuth->obtainServiceInstance($serviceName);
         $service->setupCredentials(array('key' => $serviceConfig['key'], 'secret' => $serviceConfig['secret'], 'redirect_uri' => $serviceConfig['redirect_uri']));
         if (isset($serviceConfig['scopes'])) {
             $service->setScopes($serviceConfig['scopes']);
         }
         $service->init();
         $this->oAuthServices[$serviceName] = $service;
     }
 }