From 7c45b7a533302f82c35a7f6e760ffb3655b5935d Mon Sep 17 00:00:00 2001 From: Ronny Gericke Date: Mon, 22 Apr 2024 15:57:08 +0200 Subject: [PATCH] [FIX] base64 decode on base64url generated tokens --- src/Provider/AdfsResourceOwner.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Provider/AdfsResourceOwner.php b/src/Provider/AdfsResourceOwner.php index c473c93..fbc6e83 100644 --- a/src/Provider/AdfsResourceOwner.php +++ b/src/Provider/AdfsResourceOwner.php @@ -69,18 +69,18 @@ public function toArray() * @param AccessToken $token * @return array */ - protected function parseToken(AccessToken $token) { - if (is_string($token)) { + protected function parseToken(AccessToken $accessToken) { + if (is_string($accessToken)) { return null; } - $tokenValues = $token->getValues(); + $tokenValues = $accessToken->getValues(); $tokens = []; if (isset($tokenValues['id_token'])) { $tokens[] = $tokenValues['id_token']; } - $tokens[] = $token->getToken(); + $tokens[] = $accessToken->getToken(); $data = []; foreach ($tokens as $token) { @@ -93,7 +93,7 @@ protected function parseToken(AccessToken $token) { continue; } $token = $token[1]; - $json = base64_decode($token); + $json = base64_decode(strtr($token, '-_', '+/')); if (!is_string($json)) { continue;