当前位置: 首页>>代码示例>>PHP>>正文


PHP Hybrid_Auth::storage方法代码示例

本文整理汇总了PHP中Hybrid_Auth::storage方法的典型用法代码示例。如果您正苦于以下问题:PHP Hybrid_Auth::storage方法的具体用法?PHP Hybrid_Auth::storage怎么用?PHP Hybrid_Auth::storage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hybrid_Auth的用法示例。


在下文中一共展示了Hybrid_Auth::storage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getUser

 public static function getUser($token)
 {
     $config = \Config::get('hybridauth');
     $socialAuth = new \Hybrid_Auth($config);
     $socialAuth->storage()->set("hauth_session.facebook.is_logged_in", 1);
     $socialAuth->storage()->set("hauth_session.facebook.token.access_token", $token);
     return SocialLoginManager::getUser('facebook');
 }
开发者ID:juanjolainez,项目名称:SecondLife,代码行数:8,代码来源:FacebookManager.php

示例2: getUser

 public static function getUser($token, $secret)
 {
     $config = \Config::get('hybridauth');
     $socialAuth = new \Hybrid_Auth($config);
     $socialAuth->storage()->set("hauth_session.twitter.is_logged_in", 1);
     $socialAuth->storage()->set("hauth_session.twitter.token.access_token", $token);
     $socialAuth->storage()->set("hauth_session.twitter.token.access_token_secret", $secret);
     return SocialLoginManager::getUser('twitter');
 }
开发者ID:juanjolainez,项目名称:SecondLife,代码行数:9,代码来源:TwitterManager.php

示例3: loginFinish

 /**
  * finish login step 
  */
 function loginFinish()
 {
     parent::loginFinish();
     $this->user->profile->emailVerified = $this->user->profile->email;
     // restore the user profile
     Hybrid_Auth::storage()->set("hauth_session.{$this->providerId}.user", $this->user);
 }
开发者ID:alijaffar,项目名称:PHP-Login-Framework,代码行数:10,代码来源:Yahoo.php

示例4: loginFinish

 /**
  * finish login step 
  */
 function loginFinish()
 {
     parent::loginFinish();
     $uid = str_replace("http://steamcommunity.com/openid/id/", "", $this->user->profile->identifier);
     if ($uid) {
         $data = @file_get_contents("http://steamcommunity.com/profiles/{$uid}/?xml=1");
         $data = @new SimpleXMLElement($data);
         if (!is_object($data)) {
             return false;
         }
         $this->user->profile->displayName = (string) $data->{'steamID'};
         $this->user->profile->photoURL = (string) $data->{'avatarMedium'};
         $this->user->profile->description = (string) $data->{'summary'};
         $realname = (string) $data->{'realname'};
         if ($realname) {
             $this->user->profile->displayName = $realname;
         }
         $customURL = (string) $data->{'customURL'};
         if ($customURL) {
             $this->user->profile->profileURL = "http://steamcommunity.com/id/{$customURL}/";
         }
         // restore the user profile
         Hybrid_Auth::storage()->set("hauth_session.{$this->providerId}.user", $this->user);
     }
 }
开发者ID:stalker780,项目名称:opencart-hybridauth,代码行数:28,代码来源:Steam.php

示例5: getUserProfile

 /**
  * load the user profile from the IDp api client
  */
 function getUserProfile()
 {
     // refresh tokens if needed
     $this->refreshToken();
     // Vkontakte requires user id, not just token for api access
     $params['uid'] = Hybrid_Auth::storage()->get("hauth_session.{$this->providerId}.user_id");
     $params['fields'] = 'first_name,last_name,nickname,screen_name,sex,bdate,timezone,photo_rec,photo_big';
     // ask vkontakte api for user infos
     $response = $this->api->api("https://api.vk.com/method/getProfiles", 'GET', $params);
     if (!isset($response->response[0]) || !isset($response->response[0]->uid) || isset($response->error)) {
         throw new Exception("User profile request failed! {$this->providerId} returned an invalid response.", 6);
     }
     $response = $response->response[0];
     $this->user->profile->identifier = property_exists($response, 'uid') ? $response->uid : "";
     $this->user->profile->firstName = property_exists($response, 'first_name') ? $response->first_name : "";
     $this->user->profile->lastName = property_exists($response, 'last_name') ? $response->last_name : "";
     $this->user->profile->displayName = property_exists($response, 'nickname') ? $response->nickname : "";
     $this->user->profile->photoURL = property_exists($response, 'photo_big') ? $response->photo_big : "";
     $this->user->profile->profileURL = property_exists($response, 'screen_name') ? "http://vk.com/" . $response->screen_name : "";
     if (property_exists($response, 'sex')) {
         switch ($response->sex) {
             case 1:
                 $this->user->profile->gender = 'female';
                 break;
             case 2:
                 $this->user->profile->gender = 'male';
                 break;
             default:
                 $this->user->profile->gender = '';
                 break;
         }
     }
     return $this->user->profile;
 }
开发者ID:AveVlad,项目名称:hybridauth,代码行数:37,代码来源:Vkontakte.php

示例6: loginFinish

 /**
  * finish login step
  */
 function loginFinish()
 {
     parent::loginFinish();
     $this->user->profile->profileURL = $this->user->profile->identifier;
     // https://ru.wargaming.net/id/5069690-Steel_Master/
     $this->user->profile->identifier = preg_replace('/^[^0-9]+([0-9]+)-.+$/', '$1', $this->user->profile->identifier);
     // restore the user profile
     Hybrid_Auth::storage()->set("hauth_session.{$this->providerId}.user", $this->user);
 }
开发者ID:alijaffar,项目名称:PHP-Login-Framework,代码行数:12,代码来源:WarGaming.php

示例7: loginFinish

 /**
  * finish login step 
  */
 function loginFinish()
 {
     if (!$_REQUEST['dr_auth_code']) {
         throw new Exception('Authentication failed! ' . $this->providerId . ' returned an invalid Token and Verifier.', 5);
     }
     $this->token('access_token', $_REQUEST['dr_auth_code']);
     // set user as logged in
     $this->setUserConnected();
     Hybrid_Auth::storage()->set("hauth_session.{$this->providerId}.user", $this->user);
 }
开发者ID:lcorbasson,项目名称:hybridauth,代码行数:13,代码来源:Draugiem.php

示例8: loginFinish

 function loginFinish()
 {
     parent::loginFinish();
     $this->user->profile->identifier = str_ireplace("http://steamcommunity.com/openid/id/", "", $this->user->profile->identifier);
     if (!$this->user->profile->identifier) {
         throw new Exception("Authentication failed! {$this->providerId} returned an invalid user ID.", 5);
     }
     // If API key is not provided, use legacy API methods
     if (!empty($this->config['keys']['key'])) {
         $this->getUserProfileWebAPI($this->config['keys']['key']);
     } else {
         $this->getUserProfileLegacyAPI();
     }
     Hybrid_Auth::storage()->set("hauth_session.{$this->providerId}.user", $this->user);
 }
开发者ID:navatech,项目名称:yii-hoauth,代码行数:15,代码来源:Steam.php

示例9: loginFinish

 /**
  * finish login step 
  */
 function loginFinish()
 {
     parent::loginFinish();
     $this->user->profile->identifier = str_ireplace("http://steamcommunity.com/openid/id/", "", $this->user->profile->identifier);
     if (!$this->user->profile->identifier) {
         throw new Exception("Authentication failed! {$this->providerId} returned an invalid user ID.", 5);
     }
     // if api key is provided, we attempt to use steam web api
     if (isset(Hybrid_Auth::$config['providers']['Steam']['keys']['key']) && Hybrid_Auth::$config['providers']['Steam']['keys']['key']) {
         $userProfile = $this->getUserProfileWebAPI(Hybrid_Auth::$config['providers']['Steam']['keys']['key']);
     } else {
         $userProfile = $this->getUserProfileLegacyAPI();
     }
     // fetch user profile
     foreach ($userProfile as $k => $v) {
         $this->user->profile->{$k} = $v ? $v : $this->user->profile->{$k};
     }
     // store user profile
     Hybrid_Auth::storage()->set("hauth_session.{$this->providerId}.user", $this->user);
 }
开发者ID:designwall,项目名称:dw-social-login,代码行数:23,代码来源:Steam.php

示例10: getUserProfile

 /**
  * load the user profile from the IDp api client
  */
 function getUserProfile()
 {
     // refresh tokens if needed
     $this->refreshToken();
     // Vkontakte requires user id, not just token for api access
     $params['uid'] = Hybrid_Auth::storage()->get("hauth_session.{$this->providerId}.user_id");
     $params['fields'] = implode(',', $this->fields);
     // ask vkontakte api for user infos
     $response = $this->api->api('getProfiles', 'GET', $params);
     if (!isset($response->response[0]) || !isset($response->response[0]->uid) || isset($response->error)) {
         throw new Exception("User profile request failed! {$this->providerId} returned an invalid response.", 6);
     }
     // Fill datas
     $response = reset($response->response);
     foreach ($this->getUserByResponse($response, true) as $k => $v) {
         $this->user->profile->{$k} = $v;
     }
     // Additional data
     $this->user->profile->email = Hybrid_Auth::storage()->get("hauth_session.{$this->providerId}.user_email");
     return $this->user->profile;
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:24,代码来源:Vkontakte.php

示例11: clearTokens

 /**
  * clear all existen tokens for this provider
  */
 public function clearTokens()
 {
     Hybrid_Auth::storage()->deleteMatch("hauth_session.{$this->providerId}.");
 }
开发者ID:Lavoaster,项目名称:PVLive,代码行数:7,代码来源:Provider_Model.php

示例12: get_option

` account to completely end your session.</p>
    <a class="button" href="<?php 
    echo $url;
    ?>
" ><span>Continue</span></a> 
</div>
</body>
<?php 
} else {
    if (!empty($provider)) {
        $SocialAuth_WP_providers = get_option('SocialAuth_WP_providers');
        if (is_array($SocialAuth_WP_providers) && count($SocialAuth_WP_providers)) {
            $config = array();
            if (isset($SocialAuth_WP_providers[$provider])) {
                $config["base_url"] = plugin_dir_url(__FILE__) . 'hybridauth/';
                $config["providers"] = array();
                //this si same as orig config, no need to amke config again
                $config["providers"][$provider] = $SocialAuth_WP_providers[$provider];
            } else {
                echo "Current Provider is unknowun to system.";
                exit;
            }
            $config["providers"][$provider] = $HA_PROVIDER_CONFIG['providers'][$provider];
            require_once dirname(__FILE__) . "/hybridauth/Hybrid/Auth.php";
            $hybridauth = new Hybrid_Auth($config);
            Hybrid_Auth::storage()->delete("hauth_session.{$provider}.is_logged_in");
        }
    }
    $a = preg_replace("/amp\\;/", "", $a);
    header('Location: ' . $a);
}
开发者ID:3pillarlabs,项目名称:socialauth-wp,代码行数:31,代码来源:logout.php

示例13: returnToCallbackUrl

 /**
  * Redirect the user to hauth_return_to (the callback url)
  * @return void
  */
 function returnToCallbackUrl()
 {
     // get the stored callback url
     $callback_url = Hybrid_Auth::storage()->get("hauth_session.{$this->id}.hauth_return_to");
     // if the user presses the back button in the browser and we already deleted the hauth_return_to from
     // the session in the previous request, we will redirect to '/' instead of displaying a blank page.
     if (!$callback_url) {
         $callback_url = '/';
     }
     // remove some unneeded stored data
     Hybrid_Auth::storage()->delete("hauth_session.{$this->id}.hauth_return_to");
     Hybrid_Auth::storage()->delete("hauth_session.{$this->id}.hauth_endpoint");
     Hybrid_Auth::storage()->delete("hauth_session.{$this->id}.id_provider_params");
     // back to home
     Hybrid_Auth::redirect($callback_url);
 }
开发者ID:niravpatel2008,项目名称:ubiquitous-octo-tatertot,代码行数:20,代码来源:Provider_Adapter.php

示例14: getApiError

 /**
  * return api error
  */
 public static function getApiError()
 {
     return Hybrid_Auth::storage() ? Hybrid_Auth::storage()->get("hauth_session.error.apierror") : '';
 }
开发者ID:Vatia13,项目名称:dancesport,代码行数:7,代码来源:Error.php

示例15: function

$app->get('/api/languages', 'getLanguages');
// for add page..
$app->get('/api/partsofspeech', 'getPartsOfSpeech');
// for add page..
$app->get('/api/bins/', 'getBins');
// for bins page
$app->get('/api/icons/:word', function ($word) use($app, $model) {
    echo $model->getIcons($word);
});
// not working on live server
$app->post('/api/u/words', $authenticate($app), function () use($app, $model) {
    $session_identifier = Hybrid_Auth::storage()->get('user');
    echo $model->getMyWords($session_identifier);
});
$app->post('/api/u/bins', $authenticate($app), function () use($app, $model) {
    $session_identifier = Hybrid_Auth::storage()->get('user');
    echo $model->getMyBins($session_identifier);
});
$app->run();
// POST to api/add/word
function addWord()
{
    $app = \Slim\Slim::getInstance();
    $request = $app->request();
    $data = json_decode($request->getBody());
    $i = 0;
    // To get each WordID[$i]
    foreach ($data->words as $word) {
        // Insert word into words table
        $sql_words = "INSERT INTO `words` (`Word`, `Gender`, `Case`, `Infinitive`, `Aspect`, `Conjugation`, `Person`, `Number`, `IconID`, `IconAuthor`, `IconTerm`, `Timestamp`, `Salt`) VALUES (:word, NULL, NULL, NULL, NULL, NULL, NULL, NULL, :iconID, :iconAuthor, :iconTerm, CURRENT_TIMESTAMP, :salt);";
        try {
开发者ID:McMillanThomas,项目名称:wordbin,代码行数:31,代码来源:index.php


注:本文中的Hybrid_Auth::storage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。