From 0566f9db8f53bf340d459e614726b5304933d5ae Mon Sep 17 00:00:00 2001 From: Jan Klan <5463371+janklan@users.noreply.github.com> Date: Fri, 18 Nov 2022 11:16:51 +1030 Subject: [PATCH] Handle empty ID token claim AccessToken::getIdTokenClaims() can return null, but Azure::getRootMicrosoftGraphUri() expected an array. --- src/Provider/Azure.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Provider/Azure.php b/src/Provider/Azure.php index 7f99b7a..3f72f2b 100644 --- a/src/Provider/Azure.php +++ b/src/Provider/Azure.php @@ -217,8 +217,8 @@ public function getRootMicrosoftGraphUri($accessToken) $version = $this->defaultEndPointVersion; } else { $idTokenClaims = $accessToken->getIdTokenClaims(); - $tenant = array_key_exists('tid', $idTokenClaims) ? $idTokenClaims['tid'] : $this->tenant; - $version = array_key_exists('ver', $idTokenClaims) ? $idTokenClaims['ver'] : $this->defaultEndPointVersion; + $tenant = is_array($idTokenClaims) && array_key_exists('tid', $idTokenClaims) ? $idTokenClaims['tid'] : $this->tenant; + $version = is_array($idTokenClaims) && array_key_exists('ver', $idTokenClaims) ? $idTokenClaims['ver'] : $this->defaultEndPointVersion; } $openIdConfiguration = $this->getOpenIdConfiguration($tenant, $version); return 'https://' . $openIdConfiguration['msgraph_host'];