當前位置: 首頁>>代碼示例>>PHP>>正文


PHP API::getTokenAuth方法代碼示例

本文整理匯總了PHP中Piwik\Plugins\UsersManager\API::getTokenAuth方法的典型用法代碼示例。如果您正苦於以下問題:PHP API::getTokenAuth方法的具體用法?PHP API::getTokenAuth怎麽用?PHP API::getTokenAuth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\Plugins\UsersManager\API的用法示例。


在下文中一共展示了API::getTokenAuth方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _checkUserHasNotChanged

 private function _checkUserHasNotChanged($user, $newPassword, $newEmail = null, $newAlias = null)
 {
     if (is_null($newEmail)) {
         $newEmail = $user['email'];
     }
     if (is_null($newAlias)) {
         $newAlias = $user['alias'];
     }
     $userAfter = $this->api->getUser($user["login"]);
     unset($userAfter['date_registered']);
     // we now compute what the token auth should be, it should always be a hash of the login and the current password
     // if the password has changed then the token_auth has changed!
     $user['token_auth'] = $this->api->getTokenAuth($user["login"], md5($newPassword));
     $user['password'] = md5($newPassword);
     $user['email'] = $newEmail;
     $user['alias'] = $newAlias;
     $user['superuser_access'] = 0;
     $this->assertEquals($user, $userAfter);
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:19,代碼來源:UsersManagerTest.php

示例2: doAuthenticateSession

 /**
  * Authenticates the user.
  *
  * Derived classes can override this method to customize authentication logic or impose
  * extra requirements on the user trying to login.
  *
  * @param AuthInterface $auth The Auth implementation to use when authenticating.
  * @return AuthResult
  */
 protected function doAuthenticateSession(AuthInterface $auth)
 {
     $login = $auth->getLogin();
     $tokenAuthSecret = null;
     try {
         $tokenAuthSecret = $auth->getTokenAuthSecret();
     } catch (Exception $ex) {
         Log::debug("SessionInitializer::doAuthenticateSession: token_auth secret for %s not available before user" . " is authenticated.", $login);
     }
     $tokenAuth = empty($tokenAuthSecret) ? null : $this->usersManagerAPI->getTokenAuth($login, $tokenAuthSecret);
     /**
      * @deprecated Create a custom SessionInitializer instead.
      */
     Piwik::postEvent('Login.authenticate', array($auth->getLogin(), $tokenAuth));
     return $auth->authenticate();
 }
開發者ID:FluentDevelopment,項目名稱:piwik,代碼行數:25,代碼來源:SessionInitializer.php

示例3: makeSuccessLogin

 protected function makeSuccessLogin($userInfo)
 {
     $successCode = $userInfo['superuser_access'] ? AuthResult::SUCCESS_SUPERUSER_AUTH_CODE : AuthResult::SUCCESS;
     $tokenAuth = $this->usersManagerAPI->getTokenAuth($userInfo['login'], $this->getTokenAuthSecret());
     return new AuthResult($successCode, $userInfo['login'], $tokenAuth);
 }
開發者ID:heiglandreas,項目名稱:plugin-LoginLdap,代碼行數:6,代碼來源:Base.php


注:本文中的Piwik\Plugins\UsersManager\API::getTokenAuth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。