Exemplo n.º 1
0
 /**
  */
 public function authenticate()
 {
     if ($user = $this->env->auth->module->authenticate_remote_user($this->env)) {
         $this->save_user($user);
         return Net_HTTP::redirect_to(Core::if_not_set($this->env->request, 'url', '/'));
     }
     return $this->index();
 }
Exemplo n.º 2
0
 /**
  * @abstract
  *
  * @param OpenId_Client $client
  * @param boolean       $identifier_select
  */
 public function redirect(OpenId_Client $client, $identifier_select = false)
 {
     //TODO: в константы
     $id_select = 'http://specs.openid.net/auth/2.0/identifier_select';
     $params = array('openid.ns' => 'http://specs.openid.net/auth/2.0', 'openid.return_to' => $client->option('return_url'), 'openid.mode' => 'checkid_setup', 'openid.identity' => $client->identity, 'openid.realm' => $client->option('trust_root'));
     if ($identifier_select) {
         $params['openid.identity'] = $params['openid.claimed_id'] = $id_select;
     } else {
         $params['openid.identity'] = $client->identity;
         $params['openid.claimed_id'] = $client->claimed_id;
     }
     foreach ($client->params as $name => $p) {
         if ($client->option($name)) {
             $params = array_merge($params, $p->build($client->required, $client->optional, $client));
         }
     }
     return Net_HTTP::redirect_to(Net_HTTP::Request($client->server)->parameters($params)->url);
 }
Exemplo n.º 3
0
 /**
  * @param string  $callback
  * @param boolean $authorize
  *
  * @return Net_HTTP_Response
  */
 public function login_3legged_redirect($callback = '', $authorize = true)
 {
     $callback = $this->callback_url ? $this->callback_url : $callback;
     if ($this->is_version(1)) {
         $request_token = $this->get_request_token($callback);
         $this->store->set('request_token', $request_token);
     }
     $redirect_url = $this->get_auth_url($callback, $authorize);
     return Net_HTTP::redirect_to($redirect_url);
 }
Exemplo n.º 4
0
 /**
  * @return Net_HTTP_Response
  */
 public function delete()
 {
     $this->env->auth->user = null;
     unset($this->env->request->session['user_id']);
     return Net_HTTP::redirect_to(Core::if_not_set($this->env->request, 'url', '/'));
 }
Exemplo n.º 5
0
 /**
  * @param WS_Enviroment $env
  */
 protected function redirect($env)
 {
     return Net_HTTP::redirect_to($env->request[Service_OAuth_Middleware::option('return_url_name')] . '?' . $env->request->query);
 }
Exemplo n.º 6
0
 /**
  * @param string $location
  */
 protected function redirect_to($location)
 {
     return Net_HTTP::redirect_to($location);
 }