|
27 | 27 | use SimpleSAML\Module\oidc\Entities\Interfaces\AccessTokenEntityInterface; |
28 | 28 | use SimpleSAML\Module\oidc\Entities\Interfaces\AuthCodeEntityInterface; |
29 | 29 | use SimpleSAML\Module\oidc\Entities\Interfaces\RefreshTokenEntityInterface; |
| 30 | +use SimpleSAML\Module\oidc\Entities\ScopeEntity; |
30 | 31 | use SimpleSAML\Module\oidc\Entities\UserEntity; |
31 | 32 | use SimpleSAML\Module\oidc\Factories\Entities\AccessTokenEntityFactory; |
32 | 33 | use SimpleSAML\Module\oidc\Factories\Entities\AuthCodeEntityFactory; |
@@ -347,6 +348,7 @@ protected function issueOidcAuthCode( |
347 | 348 | $userIdentifier, |
348 | 349 | $redirectUri, |
349 | 350 | $authorizationRequest->getNonce(), |
| 351 | + $authorizationRequest->getIssuerState(), |
350 | 352 | flowTypeEnum: $flowType, |
351 | 353 | authorizationDetails: $authorizationRequest->getAuthorizationDetails(), |
352 | 354 | boundClientId: $authorizationRequest->getBoundClientId(), |
@@ -615,6 +617,7 @@ public function respondToAccessTokenRequest( |
615 | 617 | $storedAuthCodeEntity->getAuthorizationDetails(), |
616 | 618 | $storedAuthCodeEntity->getBoundClientId(), |
617 | 619 | $storedAuthCodeEntity->getBoundRedirectUri(), |
| 620 | + $storedAuthCodeEntity->getIssuerState(), |
618 | 621 | ); |
619 | 622 | $this->getEmitter()->emit(new RequestEvent(RequestEvent::ACCESS_TOKEN_ISSUED, $request)); |
620 | 623 | $responseType->setAccessToken($accessToken); |
@@ -893,6 +896,28 @@ public function validateAuthorizationRequestWithRequestRules( |
893 | 896 | ); |
894 | 897 | $authorizationRequest->setAuthorizationDetails($authorizationDetails); |
895 | 898 |
|
| 899 | + // TODO This is a band-aid fix for having credential claims in the userinfo endpoint when |
| 900 | + // only VCI authorizationDetails are supplied. This requires configuring a matching OIDC scope |
| 901 | + // that has all the credential type claims as well. |
| 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 | + } |
| 915 | + } |
| 916 | + } |
| 917 | + $this->loggerService->debug('authorizationDetails Resolved Scopes: ', ['scopes' => $scopes]); |
| 918 | + $authorizationRequest->setScopes($scopes); |
| 919 | + } |
| 920 | + |
896 | 921 | // Check if we are using a generic client for this request. This can happen for non-registered clients |
897 | 922 | // in VCI flows. This can be removed once the VCI clients (wallets) are properly registered using DCR. |
898 | 923 | if ($client->isGeneric()) { |
|
0 commit comments