Skip to content

Commit

Permalink
Merge pull request #1 from elbformat/fix_break_on_tokens_with_certain…
Browse files Browse the repository at this point in the history
…_characters

[FIX] base64 decode on base64url generated tokens
  • Loading branch information
rgericke-elb authored Apr 22, 2024
2 parents 3ac63a7 + 7c45b7a commit 1c79698
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Provider/AdfsResourceOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit 1c79698

Please sign in to comment.