|
18 | 18 | TokenRequest, |
19 | 19 | REDIRECT_URI_CTX, |
20 | 20 | CODE_CHALLENGE_CTX, |
21 | | - CODE_CHALLENGE_METHOD_CTX |
| 21 | + CODE_CHALLENGE_METHOD_CTX, |
| 22 | + SCOPE_CTX |
22 | 23 | ) |
23 | 24 | from pyeudiw.openid4vci.models.token_response import TokenResponse |
24 | 25 | from pyeudiw.openid4vci.storage.engine import OpenId4VciEngine |
@@ -79,14 +80,21 @@ def endpoint(self, context: Context): |
79 | 80 | CONFIG_CTX: self.config, |
80 | 81 | REDIRECT_URI_CTX: entity.redirect_uri, |
81 | 82 | CODE_CHALLENGE_METHOD_CTX: entity.code_challenge_method, |
82 | | - CODE_CHALLENGE_CTX: entity.code_challenge |
| 83 | + CODE_CHALLENGE_CTX: entity.code_challenge, |
| 84 | + SCOPE_CTX: entity.scope |
83 | 85 | }) |
84 | 86 | iat = iat_now() |
| 87 | + authorization_details = entity.authorization_details |
| 88 | + if authorization_details or len(authorization_details) > 0: |
| 89 | + for ad in authorization_details: |
| 90 | + ad.credential_identifiers = self.config_utils.get_credential_configurations_supported( |
| 91 | + ad.credential_configuration_id).scope |
| 92 | + |
85 | 93 | return TokenResponse.to_created_response( |
86 | 94 | self._to_token(iat, entity, TokenTypsEnum.ACCESS_TOKEN_TYP), |
87 | 95 | self._to_token(iat, entity, TokenTypsEnum.REFRESH_TOKEN_TYP), |
88 | 96 | iat + self.config_utils.get_jwt().access_token_exp, |
89 | | - entity.authorization_details |
| 97 | + authorization_details |
90 | 98 | ) |
91 | 99 | except (InvalidRequestException, InvalidScopeException, JWSVerificationError, ValidationError, TypeError) as e: |
92 | 100 | return self._handle_400(context, self._handle_validate_request_error(e, "token"), e) |
|
0 commit comments