Guest User

Untitled

a guest
Jan 21st, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. $provider->validateAccessToken($token);
  2.  
  3. $keys = $this->getJwtVerificationKeys();
  4. (array)JWT::decode($accessToken, $keys, ['RS256'])
  5.  
  6. public static function decode($jwt, $key, array $allowed_algs = array())
  7. $tks = explode('.', $jwt);
  8. list($headb64, $bodyb64, $cryptob64) = $tks;
  9. $header = static::jsonDecode(static::urlsafeB64Decode($headb64))
  10. $sig = static::urlsafeB64Decode($cryptob64);
  11. $key = $key[$header->kid];
  12.  
  13. static::verify("$headb64.$bodyb64", $sig, $key, $header->alg);
  14.  
  15. $obj = json_decode($input, false, 512, JSON_BIGINT_AS_STRING);
  16.  
  17. public static function urlsafeB64Decode($input)
  18. $remainder = strlen($input) % 4;
  19. if ($remainder) {
  20. $padlen = 4 - $remainder;
  21. $input .= str_repeat('=', $padlen);
  22. }
  23. return base64_decode(strtr($input, '-_', '+/'));
  24.  
  25. private static function verify($msg, $signature, $key, $alg)
  26. list($function, $algorithm) = static::$supported_algs[$alg]; // list('openssl', 'SHA256')
  27. openssl_verify($msg, $signature, $key, $algorithm);
Add Comment
Please, Sign In to add comment