Пример #1
0
 /**
  * Initiate and check user authentication, the method will try to detect current 
  * cookie for this session and verify the cookie with the database, it has to 
  * be verify so that no one else could try to copy the same cookie configuration 
  * and use it as their own.
  * 
  * @todo    need to use User-Agent as one of the hash value 
  * 
  * @access  private
  * @return  bool
  */
 public function __construct()
 {
     // allow to disable user auth, would be useful when database not available
     if (false === Config::get('autho.normal.enabled', true)) {
         return;
     }
     $this->strategy = Auth_Strategy::make('normal')->authenticate();
     // short-hand variable
     $this->provider = $this->strategy->provider;
 }
Пример #2
0
 /**
  * Get authorization code from callback and fetch user access_token and other information
  *
  * @access  public
  * @param   string      $provider
  * @return  Response
  * @throws  Auth_Strategy_Exception
  */
 public function action_callback($provider = null)
 {
     // if provider data is somehow empty, it might not came from a provider.
     if (empty($provider)) {
         throw new HttpNotFoundException();
     }
     try {
         $strategy = Auth_Strategy::make($provider);
         Auth_Strategy::login_or_register($strategy);
     } catch (Auth_Strategy_Exception $e) {
         return $this->action_error($provider, $e->getMessage());
     }
 }
Пример #3
0
 public function __construct($provider)
 {
     parent::__construct($provider);
     $this->provider = Auth_Provider_Normal::make();
     return $this;
 }