143,7 → 143,7 |
protected function decoderJeton($jeton) { |
$parts = explode('.', $jeton); |
$payload = $parts[1]; |
$payload = $this->urlsafeB64Decode($payload); |
$payload = base64_decode($payload); |
$payload = json_decode($payload, true); |
|
return $payload; |
150,22 → 150,6 |
} |
|
/** |
* Decode a string with URL-safe Base64. |
* copié depuis firebase/jwt |
* |
* @param string $input A Base64 encoded string |
* @return string A decoded string |
*/ |
protected function urlsafeB64Decode($input) { |
$remainder = strlen($input) % 4; |
if ($remainder) { |
$padlen = 4 - $remainder; |
$input .= str_repeat('=', $padlen); |
} |
return base64_decode(strtr($input, '-_', '+/')); |
} |
|
/** |
* Retourne un profil d'utilisateur non connecté (anonyme), avec un identifiant de session |
* PHP qui permet de suivre son activité |
*/ |
352,4 → 336,4 |
} |
return $headers; |
} |
} |
} |