Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/kotlin/eu/europa/ec/eudi/openid4vci/Issuance.kt
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ fun interface RequestIssuance {
/**
* Places a request to the credential issuance endpoint.
*
* If the [AuthorizedRequest] contains authorization details for the requested
* [IssuanceRequestPayload.credentialConfigurationIdentifier], then the [requestPayload] must be
* [IssuanceRequestPayload.IdentifierBased] and the credential identifier must be one of the authorized identifiers.
*
* @param requestPayload the payload of the request
* @param proofsSpecification the specification of proofs to be included in the request
* @return the possibly updated [AuthorizedRequest] (if updated it will contain a fresh updated Resource-Server DPoP Nonce)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ internal class RequestIssuanceImpl(
requestPayload: IssuanceRequestPayload,
proofsSpecification: ProofsSpecification,
): Result<AuthorizedRequestAnd<SubmissionOutcome>> = runCatchingCancellable {
val authorizedIdentifiers = credentialIdentifiers?.get(requestPayload.credentialConfigurationIdentifier)
if (!authorizedIdentifiers.isNullOrEmpty()) {
require(requestPayload is IssuanceRequestPayload.IdentifierBased) {
"Authorization detail type of openid_credential require usage of credential identifiers in credential request"
}
require(requestPayload.credentialIdentifier in authorizedIdentifiers) {
"Credential identifier ${requestPayload.credentialIdentifier.value} is not authorized"
}
}

val (proofs, proofsDpopNonce) = buildProofs(proofsSpecification, requestPayload.credentialConfigurationIdentifier, grant)
val credentialRequest = buildRequest(requestPayload, proofs, credentialIdentifiers.orEmpty())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class IssuanceSingleRequestTest {
CredentialConfigurationIdentifier("eu.europa.ec.eudiw.pid_vc_sd_jwt"),
CredentialIdentifier("DUMMY"),
)
assertThrows<IllegalStateException> {
assertThrows<IllegalArgumentException> {
with(issuer) {
authorizedRequest.request(requestPayload, noKeyAttestationJwtProofsSpec(Curve.P_256, 1)).getOrThrow()
}
Expand Down
Loading