本文整理汇总了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);
}
示例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();
}
示例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);
}