예제 #1
0
 /**
  * This action issues access and refresh tokens and is called only
  * by the 3rd party. All output should be JSON.
  *
  * You DO NOT need to extend/replace this action.
  */
 public function action_token()
 {
     $this->response->headers('Content-Type', File::mime_by_ext('json'));
     try {
         // Attempt to issue a token
         $this->response->body($this->_oauth->token());
     } catch (OAuth2_Exception $e) {
         // Something went wrong, lets give a formatted error
         $this->response->status(400);
         $this->response->body($e->getJsonError());
     }
 }
예제 #2
0
 public function access($code, $options = array())
 {
     if ($code === null) {
         throw new OAuth2_Exception('Expected Authorization Code from ' . ucfirst($this->name) . ' is missing');
     }
     return parent::access($code, $options);
 }
예제 #3
0
파일: Linkedin.php 프로젝트: deksoke/ci
 public function __construct(array $options = array())
 {
     if (empty($options['scope'])) {
         $options['scope'] = array('r_basicprofile', 'r_emailaddress');
     }
     // Array it if its string
     $options['scope'] = (array) $options['scope'];
     parent::__construct($options);
 }
예제 #4
0
파일: oauth2.php 프로젝트: rafi/oauth
 public function before()
 {
     parent::before();
     // Load the cookie session
     $this->session = Session::instance('cookie');
     // Get the name of the demo from the class name
     $provider = strtolower($this->api);
     // Load the provider
     $this->provider = OAuth2_Provider::factory($provider);
     // Load the client
     $this->client = OAuth2_Client::factory(Kohana::config("oauth.{$provider}"));
     if ($token = $this->session->get($this->key('access'))) {
         // Make the access token available
         $this->token = $token;
     }
 }
 public function __construct(array $options = array())
 {
     empty($options['scope']) and $options['scope'] = 'basic';
     $options['scope'] = (array) $options['scope'];
     parent::__construct($options);
 }
예제 #6
0
 protected function _oauth_verify_token($scope = NULL)
 {
     list($client_id, $user_id) = $this->_oauth->verify_token($scope);
     $this->_oauth_client_id = $client_id;
     $this->_oauth_user_id = $user_id;
 }
예제 #7
0
파일: oauth2.php 프로젝트: ZerGabriel/cms-1
 /**
  * @param  $name  Provider name
  * @param  array  Provider options
  * @return OAuth2_Provider
  */
 public function provider($name, array $options = NULL)
 {
     return OAuth2_Provider::factory($name, $options);
 }