[OID4VCI] TokenResponse requires credential_identifiers in authorization_details#47404
[OID4VCI] TokenResponse requires credential_identifiers in authorization_details#47404mposolda merged 3 commits intokeycloak:mainfrom
Conversation
85752c2 to
4dc5080
Compare
e682512 to
cdceb4c
Compare
7251c14 to
f4ea1b4
Compare
421e8cb to
7139c38
Compare
forkimenjeckayang
left a comment
There was a problem hiding this comment.
A few concerns @tdiesler
Please take a look when you can
There was a problem hiding this comment.
checkAuthorizationDetails() and validateAuthorizationDetail() apply different rules to request-time credential_identifiers (authorization rejects any presence, while the token path rejects only non-empty arrays), which can lead to divergent behavior (e.g., []).
Per Section 5.1.1, additional fields for openid_credential should not invalidate the authorization details type. Could we unify both paths by accepting this field on input and ignoring/clearing it, while ensuring token responses still emit server-authoritative credential_identifiers as defined in Section 6.2?
There was a problem hiding this comment.
Yes, additional fields should not invalidate the authorization details. However, this is a field not totally unknown to the spec - it's a known field used in the wrong context.
On that basis, I suggest we align like this ...
if (credentialIdentifiers != null) {
// we also reject an empty array of credential identifiers
logger.warnf("Property credential_identifiers not allowed in authorization_details");
throw getInvalidRequestException("credential_identifiers not allowed");
}
It is unlikely that the conformance tests want to see the empty array pass.
WDYT?
4c14d33 to
d503f21
Compare
mposolda
left a comment
There was a problem hiding this comment.
@tdiesler Thanks! Added comment inline (related also to other comment by @forkimenjeckayang ).
Also one question: As mentioned here in this comment #47386 (comment) , we do not need to support credential_configuration_id parameter in the credential-request. However in this PR it is still supported. Any issues with removing support for credential_configuration_id in this PR? Or do you rather want to do as a follow-up?
| throw new AuthorizationCheckException(Response.Status.BAD_REQUEST, Errors.INVALID_REQUEST, | ||
| "Cannot parse authorization_details: " + authDetailsParam); | ||
| } | ||
| for (AuthorizationDetailsJSONRepresentation authDetailJson : authDetails) { |
There was a problem hiding this comment.
It will be nice if AuthorizationEndpointChecker does not have any direct dependencies on OID4VCI specific logic.
Is it possible to add new callback method to AuthorizationDetailsProcessorManager and AuthorizationDetailsProcessor, which will move this logic (lines 251-266) to the OID4VC specific processor? That can possibly help that we would be easily able to re-use same/similar validation like already done for token-endpoint? (As discussed in the other comment).
There was a problem hiding this comment.
yes, that's how it should be (done)
It is infact not supported, because of ... The conformance suite suite wants to see an UNKNOWN_CREDENTIAL_CONFIGURATION error, so we can't simply fail on any credential_configuration_id. In our case, it always fails because we always return This code would stay valid even if we decide to no longer return redundant |
…ion_details Signed-off-by: Thomas Diesler <[email protected]>
-- require well formed authorization details -- thanks @forkimenjeckayang Signed-off-by: Thomas Diesler <[email protected]>
25f5102 to
ccab662
Compare
Signed-off-by: Thomas Diesler <[email protected]>
mposolda
left a comment
There was a problem hiding this comment.
@tdiesler Thanks for the clarifications.
Leaving PR open for one more day in case @forkimenjeckayang has any additional feedback.
|
@mposolda FYI, this PR introduces a considerable amount of ugliness related to #47649. Invalid authorization requests are now caught early and will timeout with that Selenium exception - the root cause is lost. In case you prefer that this does not enter the code base, have a look at PR #47850. If that gets merged first, our tests could also be restored to handle their invalid auth requests properly. In |
forkimenjeckayang
left a comment
There was a problem hiding this comment.
No further concerns, approach LGTM
|
@tdiesler @forkimenjeckayang Thanks! |
closes #47386