当前位置: 首页>>代码示例>>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;未经允许,请勿转载。