コード例 #1
0
 public function addProvider(Provider $provider)
 {
     $this->providers[$provider->getId()] = $provider;
     $provider->setCallback($this);
     $provider->checkState();
 }
コード例 #2
0
 /**
  * @return int
  */
 public function getProviderId()
 {
     return parent::getId();
 }
コード例 #3
0
ファイル: Session.php プロジェクト: n8b/VMN
 /**
  * Authenticates the session owner with the provider
  *
  * @param \Elgg\HybridAuth\Provider $provider Provider
  * @param bool                      $addauth  Add auth records
  * @return \Hybrid_User_Profile|false
  */
 public function authenticate(Provider $provider, $addauth = true)
 {
     try {
         $this->restore();
         $adapter = $this->getClient()->authenticate($provider->getId(), $provider->getAdapterParams());
         $profile = $adapter ? $adapter->getUserProfile() : false;
         $this->save();
         if ($profile && $addauth) {
             $this->addAuthRecord($provider, $profile);
         }
     } catch (\Exception $e) {
         elgg_log($e->getMessage(), 'ERROR');
         set_input('error', $e->getMessage());
         $this->deauthenticate($provider);
     }
     return $profile;
 }
コード例 #4
0
 /**
  * Get the provider ID
  * @param string $provider
  * @return int
  */
 private function getProviderId($provider)
 {
     if ($provider === null || trim($provider) == '') {
         return null;
     }
     if (!isset($this->providerIds[$provider])) {
         $this->providerIds[$provider] = Provider::getId($provider);
     }
     return $this->providerIds[$provider];
 }