Skip to content

Commit c53d1c6

Browse files
committed
Add credential_configuration_id to scopes
1 parent d74d05e commit c53d1c6

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/Server/Grants/AuthCodeGrant.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use SimpleSAML\Module\oidc\Entities\Interfaces\AuthCodeEntityInterface;
2929
use SimpleSAML\Module\oidc\Entities\Interfaces\RefreshTokenEntityInterface;
3030
use SimpleSAML\Module\oidc\Entities\UserEntity;
31+
use SimpleSAML\Module\oidc\Entities\ScopeEntity;
3132
use SimpleSAML\Module\oidc\Factories\Entities\AccessTokenEntityFactory;
3233
use SimpleSAML\Module\oidc\Factories\Entities\AuthCodeEntityFactory;
3334
use SimpleSAML\Module\oidc\Helpers;
@@ -903,6 +904,23 @@ public function validateAuthorizationRequestWithRequestRules(
903904
);
904905
$authorizationRequest->setAuthorizationDetails($authorizationDetails);
905906

907+
// TODO This is a band-aid fix for having credential claims in the userinfo endpoint when
908+
// only VCI authorizationDetails are supplied. This requires configuring a matching OIDC scope
909+
// that has all the credential type claims as well.
910+
foreach ($authorizationDetails as $authorizationDetail) {
911+
if (
912+
(isset($authorizationDetail['type'])) &&
913+
($authorizationDetail['type']) === 'openid_credential'
914+
) {
915+
$credentialConfigurationId = $authorizationDetail['credential_configuration_id'] ?? null;
916+
if ($credentialConfigurationId !== null) {
917+
array_push($scopes, new ScopeEntity($credentialConfigurationId));
918+
}
919+
}
920+
}
921+
$this->loggerService->debug('authorizationDetails Resolved Scopes: ', ['scopes' => $scopes]);
922+
$authorizationRequest->setScopes($scopes);
923+
906924
// Check if we are using a generic client for this request. This can happen for non-registered clients
907925
// in VCI flows. This can be removed once the VCI clients (wallets) are properly registered using DCR.
908926
if ($client->isGeneric()) {

0 commit comments

Comments
 (0)