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


PHP PhabricatorUser::getAccountSecret方法代碼示例

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


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

示例1: getOneTimeLoginKeyHash

 /**
  * Hash a one-time login key for storage as a temporary token.
  *
  * @param PhabricatorUser User this key is for.
  * @param PhabricatorUserEmail Optionally, email to verify when
  *  link is used.
  * @param string The one time login key.
  * @return string Hash of the key.
  * task onetime
  */
 private function getOneTimeLoginKeyHash(PhabricatorUser $user, PhabricatorUserEmail $email = null, $key = null)
 {
     $parts = array($key, $user->getAccountSecret());
     if ($email) {
         $parts[] = $email->getVerificationCode();
     }
     return PhabricatorHash::digest(implode(':', $parts));
 }
開發者ID:NeoArmageddon,項目名稱:phabricator,代碼行數:18,代碼來源:PhabricatorAuthSessionEngine.php

示例2: getChunkedHash

 /**
  * Compute a chunked file hash for the viewer.
  *
  * We can not currently compute a real hash for chunked file uploads (because
  * no process sees all of the file data).
  *
  * We also can not trust the hash that the user claims to have computed. If
  * we trust the user, they can upload some `evil.exe` and claim it has the
  * same file hash as `good.exe`. When another user later uploads the real
  * `good.exe`, we'll just create a reference to the existing `evil.exe`. Users
  * who download `good.exe` will then receive `evil.exe`.
  *
  * Instead, we rehash the user's claimed hash with account secrets. This
  * allows users to resume file uploads, but not collide with other users.
  *
  * Ideally, we'd like to be able to verify hashes, but this is complicated
  * and time consuming and gives us a fairly small benefit.
  *
  * @param PhabricatorUser Viewing user.
  * @param string Claimed file hash.
  * @return string Rehashed file hash.
  */
 public static function getChunkedHash(PhabricatorUser $viewer, $hash)
 {
     if (!$viewer->getPHID()) {
         throw new Exception(pht('Unable to compute chunked hash without real viewer!'));
     }
     $input = $viewer->getAccountSecret() . ':' . $hash . ':' . $viewer->getPHID();
     return self::getChunkedHashForInput($input);
 }
開發者ID:rchicoli,項目名稱:phabricator,代碼行數:30,代碼來源:PhabricatorChunkedFileStorageEngine.php


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