Example #1
0
 /**
  * Begin login step
  */
 function loginBegin()
 {
     if (empty($this->openidIdentifier)) {
         throw new Exception("OpenID adapter require the identity provider identifier 'openid_identifier' as an extra parameter.", 4);
     }
     $this->api->identity = $this->openidIdentifier;
     $this->api->returnUrl = $this->endpoint;
     $this->api->required = array('namePerson/first', 'namePerson/last', 'namePerson/friendly', 'namePerson', 'contact/email', 'birthDate', 'birthDate/birthDay', 'birthDate/birthMonth', 'birthDate/birthYear', 'person/gender', 'pref/language', 'contact/postalCode/home', 'contact/city/home', 'contact/country/home', 'media/image/default');
     # redirect the user to the provider authentication url
     Auth::redirect($this->api->authUrl());
 }
Example #2
0
 /**
  * begin login step
  */
 function loginBegin()
 {
     $parameters = array("scope" => $this->scope, "access_type" => "offline");
     $optionals = array("scope", "access_type", "redirect_uri", "approval_prompt", "hd");
     foreach ($optionals as $parameter) {
         if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) {
             $parameters[$parameter] = $this->config[$parameter];
         }
     }
     Auth::redirect($this->api->authorizeUrl($parameters));
 }
Example #3
0
 /**
  * begin login step
  *
  * simply call Facebook::require_login().
  */
 function loginBegin()
 {
     $parameters = array("scope" => $this->scope, "redirect_uri" => $this->endpoint, "display" => "page");
     $optionals = array("scope", "redirect_uri", "display");
     foreach ($optionals as $parameter) {
         if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) {
             $parameters[$parameter] = $this->config[$parameter];
         }
     }
     // get the login url
     $url = $this->api->getLoginUrl($parameters);
     // redirect to facebook
     Auth::redirect($url);
 }
Example #4
0
 /**
  * begin login step
  */
 function loginBegin()
 {
     $tokens = $this->api->requestToken($this->endpoint);
     // request tokens as recived from provider
     $this->request_tokens_raw = $tokens;
     // check the last HTTP status code returned
     if ($this->api->http_code != 200) {
         throw new Exception("Authentification failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus($this->api->http_code), 5);
     }
     if (!isset($tokens["oauth_token"])) {
         throw new Exception("Authentification failed! {$this->providerId} returned an invalid oauth token.", 5);
     }
     $this->token("request_token", $tokens["oauth_token"]);
     $this->token("request_token_secret", $tokens["oauth_token_secret"]);
     // redirect the user to the provider authentication url with force_login
     if (isset($this->config['force_login']) && $this->config['force_login']) {
         Auth::redirect($this->api->authorizeUrl($tokens, array('force_login' => true)));
     }
     // else, redirect the user to the provider authentication url
     Auth::redirect($this->api->authorizeUrl($tokens));
 }
Example #5
0
 /**
  * Begin login step
  */
 function loginBegin()
 {
     // redirect the user to the provider authentication url
     Auth::redirect($this->api->authorizeUrl(array("scope" => $this->scope)));
 }
Example #6
0
 /**
  * Process OpenID realm request
  */
 public static function processOpenidRealm()
 {
     $output = str_replace("{X_XRDS_LOCATION}", htmlentities(Auth::getCurrentUrl(false), ENT_QUOTES, 'UTF-8') . "?get=openid_xrds&v=" . Auth::$version, file_get_contents(dirname(__FILE__) . "/../../resources/openid_realm.html"));
     print $output;
     die;
 }
Example #7
0
 /**
  * redirect the user to gk_return_to (the callback url)
  */
 function returnToCallbackUrl()
 {
     // get the stored callback url
     $callback_url = $this->getStorage()->get("gk_session.{$this->id}.gk_return_to");
     // remove some unneed'd stored data
     $this->getStorage()->delete("gk_session.{$this->id}.gk_return_to");
     $this->getStorage()->delete("gk_session.{$this->id}.gk_endpoint");
     $this->getStorage()->delete("gk_session.{$this->id}.id_provider_params");
     // Back to home
     Auth::redirect($callback_url);
 }