Skip to content

Commit 01cb611

Browse files
committed
Add a few more checks when resolving credentialConfigurationId
1 parent 82af8a8 commit 01cb611

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/Server/Grants/AuthCodeGrant.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -899,19 +899,24 @@ public function validateAuthorizationRequestWithRequestRules(
899899
// TODO This is a band-aid fix for having credential claims in the userinfo endpoint when
900900
// only VCI authorizationDetails are supplied. This requires configuring a matching OIDC scope
901901
// that has all the credential type claims as well.
902-
foreach ($authorizationDetails as $authorizationDetail) {
903-
if (
904-
(isset($authorizationDetail['type'])) &&
905-
($authorizationDetail['type']) === 'openid_credential'
906-
) {
907-
$credentialConfigurationId = $authorizationDetail['credential_configuration_id'] ?? null;
908-
if ($credentialConfigurationId !== null) {
909-
array_push($scopes, new ScopeEntity($credentialConfigurationId));
902+
if (is_array($authorizationDetails)) {
903+
/** @psalm-suppress MixedAssignment */
904+
foreach ($authorizationDetails as $authorizationDetail) {
905+
if (
906+
is_array($authorizationDetail) &&
907+
(isset($authorizationDetail['type'])) &&
908+
($authorizationDetail['type']) === 'openid_credential'
909+
) {
910+
/** @psalm-suppress MixedAssignment */
911+
$credentialConfigurationId = $authorizationDetail['credential_configuration_id'] ?? null;
912+
if (is_string($credentialConfigurationId)) {
913+
$scopes[] = new ScopeEntity($credentialConfigurationId);
914+
}
910915
}
911916
}
917+
$this->loggerService->debug('authorizationDetails Resolved Scopes: ', ['scopes' => $scopes]);
918+
$authorizationRequest->setScopes($scopes);
912919
}
913-
$this->loggerService->debug('authorizationDetails Resolved Scopes: ', ['scopes' => $scopes]);
914-
$authorizationRequest->setScopes($scopes);
915920

916921
// Check if we are using a generic client for this request. This can happen for non-registered clients
917922
// in VCI flows. This can be removed once the VCI clients (wallets) are properly registered using DCR.

0 commit comments

Comments
 (0)