Как проверить jwks / jwt с помощью openid / php -openid - PullRequest
0 голосов
/ 20 января 2020

Я пробовал несколько разных способов с парсерами, разбивая на части извлеченные файлы json_decoded и т. Д. c., Все, что я пробовал, провалилось, и хороший ответ онлайн ускользает от меня.

Как мне использовать openid и адрес, который выбирает jwks для проверки jwt и извлечения их полезных нагрузок?

Пытаясь прочитать его, в настоящее время я делаю следующее:

// This line seems to work
$openid_config = json_decode(file_get_contents($my_open_id_config_url, false, stream_context_create($options)));
$jwks_url = $openid_config->jwks_uri
$pub_key_json = json_decode(file_get_contents($jwks_url, false, stream_context_create($options)));
// The above lines seem to work
//... and I have no idea what to do next. Everything I've tried to get the actual payload fails.
// Although I've worked with other authentication methods, jwks is fairly new to me.
// To the point of there's no reason to include my failed attempts here.
// Array the last bit produces is roughly as follows; 
Array
(
  [kty] => RSA
  [use] => sig
  [kid] => ...a short possibly encoded string here...
  [x5t] => ...a short possibly encoded string here...
  [...some key here...] => ... simple string here...
  [...some key here...] => ...some likely encoded hash here...
  [x5c] => Array
      (
          [0] => ...some likely encoded hash here...
      )
)

То, к чему я стремлюсь получить хэшированную полезную нагрузку, которая должна дать мне доступ к

...