Inheritance: extends EAuthServiceBase, implements IAuthService
 /**
  * Authenticate the user.
  * @return boolean whether user was successfuly authenticated.
  */
 public function authenticate()
 {
     if (isset($_GET['error']) && $_GET['error'] == 'user_denied') {
         $this->cancel();
     }
     return parent::authenticate();
 }
Exemplo n.º 2
0
 protected function getCodeUrl($redirect_uri)
 {
     $url = parent::getCodeUrl($redirect_uri);
     if (isset($_GET['js'])) {
         $url .= '&display=popup';
     }
     return $url;
 }
 /**
  * Restore access token from the session.
  * @return boolean whether the access token was successfuly restored.
  */
 protected function restoreAccessToken()
 {
     if ($this->hasState('uid') && parent::restoreAccessToken()) {
         $this->uid = $this->getState('uid');
         return true;
     } else {
         $this->uid = null;
         return false;
     }
 }
Exemplo n.º 4
0
 protected function getCodeUrl($redirect_uri)
 {
     if (strpos($redirect_uri, '?') !== false) {
         $url = explode('?', $redirect_uri);
         $url[1] = preg_replace('#[/]#', '%2F', $url[1]);
         $redirect_uri = implode('?', $url);
     }
     // Erik Uus: Not needed as parent::getCodeUrl sets this
     //		$this->setState('redirect_uri', $redirect_uri);
     $url = parent::getCodeUrl($redirect_uri);
     if (isset($_GET['js'])) {
         $url .= '&display=popup';
     }
     return $url;
 }
Exemplo n.º 5
0
 protected function getCodeUrl($redirect_uri)
 {
     /*if (strpos($redirect_uri, '?') !== false || strpos($redirect_uri, '&') !== false)
     		throw new EAuthException('Facebook does not support url with special characters. You should use SEF urls for authentication through Facebook.', 500);*/
     if (strpos($redirect_uri, '?') !== false) {
         $url = explode('?', $redirect_uri);
         $url[1] = preg_replace('#[/]#', '%2F', $url[1]);
         $redirect_uri = implode('?', $url);
     }
     $this->setState('redirect_uri', $redirect_uri);
     $url = parent::getCodeUrl($redirect_uri);
     if (isset($_GET['js'])) {
         $url .= '&display=popup';
     }
     return $url;
 }
Exemplo n.º 6
0
 /**
  * Makes the curl request to the url.
  * @param string $url url to request.
  * @param array $options HTTP request options. Keys: query, data, referer.
  * @param boolean $parseJson Whether to parse response in json format.
  * @return string the response.
  */
 protected function makeRequest($url, $options = array(), $parseJson = true)
 {
     $options['query']['alt'] = 'json';
     return parent::makeRequest($url, $options, $parseJson);
 }
 protected function getTokenUrl($code)
 {
     return parent::getTokenUrl($code) . '&redirect_uri=' . urlencode($this->getState('redirect_uri'));
 }
Exemplo n.º 8
0
 protected function getCodeUrl($redirectUri)
 {
     //store redirect uri in session; we need to use it when requesting an access token
     $this->setState('redirect_uri', $redirectUri);
     return parent::getCodeUrl($redirectUri);
 }
Exemplo n.º 9
0
 /**
  * Add User-Agent header
  *
  * @param string $url
  * @param array $options
  * @return cURL
  */
 protected function initRequest($url, $options = array())
 {
     $ch = parent::initRequest($url, $options);
     curl_setopt($ch, CURLOPT_USERAGENT, 'yii-eauth extension');
     return $ch;
 }
Exemplo n.º 10
0
 protected function getCodeUrl($redirect_uri)
 {
     $this->setState('redirect_uri', $redirect_uri);
     return parent::getCodeUrl($redirect_uri);
 }
Exemplo n.º 11
0
 protected function getAccessToken($code)
 {
     $result = parent::getAccessToken($code);
     $this->setState('uid', $result->user_id);
     return $result->access_token;
 }