本文整理汇总了PHP中Google_Utils::urlSafeB64Encode方法的典型用法代码示例。如果您正苦于以下问题:PHP Google_Utils::urlSafeB64Encode方法的具体用法?PHP Google_Utils::urlSafeB64Encode怎么用?PHP Google_Utils::urlSafeB64Encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Google_Utils
的用法示例。
在下文中一共展示了Google_Utils::urlSafeB64Encode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeSignedJwt
/**
* Creates a signed JWT.
* @param array $payload
* @return string The signed JWT.
*/
private function makeSignedJwt($payload)
{
$header = array('typ' => 'JWT', 'alg' => 'RS256');
$segments = array(Google_Utils::urlSafeB64Encode(json_encode($header)), Google_Utils::urlSafeB64Encode(json_encode($payload)));
$signingInput = implode('.', $segments);
$signer = new Google_P12Signer($this->privateKey, $this->privateKeyPassword);
$signature = $signer->sign($signingInput);
$segments[] = Google_Utils::urlSafeB64Encode($signature);
return implode(".", $segments);
}
示例2: makeSignedJwt
private function makeSignedJwt($payload)
{
$header = array("typ" => "JWT", "alg" => "RS256");
$segments = array();
$segments[] = Google_Utils::urlSafeB64Encode(json_encode($header));
$segments[] = Google_Utils::urlSafeB64Encode(json_encode($payload));
$signing_input = implode(".", $segments);
$signature = $this->signer->sign($signing_input);
$segments[] = Google_Utils::urlSafeB64Encode($signature);
return implode(".", $segments);
}
示例3: makeSignedJwt
/**
* Creates a signed JWT.
* @param array $payload
* @return string The signed JWT.
*/
private function makeSignedJwt($payload)
{
$header = array('typ' => 'JWT', 'alg' => 'RS256');
$payload = json_encode($payload);
// Handle some overzealous escaping in PHP json that seemed to cause some errors
// with claimsets.
$payload = str_replace('\\/', '/', $payload);
$segments = array(Google_Utils::urlSafeB64Encode(json_encode($header)), Google_Utils::urlSafeB64Encode($payload));
$signingInput = implode('.', $segments);
$signer = new Google_Signer_P12($this->privateKey, $this->privateKeyPassword);
$signature = $signer->sign($signingInput);
$segments[] = Google_Utils::urlSafeB64Encode($signature);
return implode(".", $segments);
}
示例4: uploadAccount
/**
* Invokes the UploadAccount API.
*
* @param string $hashAlgorithm password hash algorithm. See Gitkit doc for
* supported names.
* @param string $hashKey raw key for the algorithm
* @param array $accounts array of account info to be uploaded
* @param null|int $rounds Rounds of the hash function
* @param null|int $memoryCost Memory cost of the hash function
*/
public function uploadAccount($hashAlgorithm, $hashKey, $accounts, $rounds, $memoryCost)
{
$data = array('hashAlgorithm' => $hashAlgorithm, 'signerKey' => Google_Utils::urlSafeB64Encode($hashKey), 'users' => $accounts);
if ($rounds) {
$data['rounds'] = $rounds;
}
if ($memoryCost) {
$data['memoryCost'] = $memoryCost;
}
$this->invokeGitkitApiWithServiceAccount('uploadAccount', $data);
}
示例5: toJsonRequest
/**
* Converts Gitkit account array to json request.
*
* @param array $accounts Gitkit account array
* @return array json request
*/
private function toJsonRequest($accounts)
{
$jsonUsers = array();
foreach ($accounts as $account) {
$user = array('email' => $account->getEmail(), 'localId' => $account->getUserId(), 'passwordHash' => Google_Utils::urlSafeB64Encode($account->getPasswordHash()), 'salt' => Google_Utils::urlSafeB64Encode($account->getSalt()));
array_push($jsonUsers, $user);
}
return $jsonUsers;
}
示例6: uploadAccount
/**
* Invokes the UploadAccount API.
*
* @param string $hashAlgorithm password hash algorithm. See Gitkit doc for
* supported names.
* @param string $hashKey raw key for the algorithm
* @param array $accounts array of account info to be uploaded
*/
public function uploadAccount($hashAlgorithm, $hashKey, $accounts)
{
$data = array('hashAlgorithm' => $hashAlgorithm, 'signerKey' => Google_Utils::urlSafeB64Encode($hashKey), 'users' => $accounts);
$this->invokeGitkitApiWithServiceAccount('uploadAccount', $data);
}
示例7: makeSignedJwt
public function makeSignedJwt($payload, $cred)
{
$header = array("typ" => "JWT", "alg" => "RS256");
$segments = array();
$segments[] = Google_Utils::urlSafeB64Encode(json_encode($header));
$segments[] = Google_Utils::urlSafeB64Encode(json_encode($payload));
$signing_input = implode(".", $segments);
$signer = new Google_Signer_P12($cred->privateKey, $cred->privateKeyPassword);
$signature = $signer->sign($signing_input);
$segments[] = Google_Utils::urlSafeB64Encode($signature);
return implode(".", $segments);
}