Skip to content

Commit

Permalink
Merge pull request #227 from walt-id/fix-presentation-submission-from…
Browse files Browse the repository at this point in the history
…-legacy-response

Fix presentation submission from legacy response
  • Loading branch information
severinstampler authored Feb 27, 2023
2 parents ca78352 + bf92a8e commit 600d815
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/kotlin/id/walt/model/oidc/SIOPv2Response.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ data class SIOPv2Response(
companion object {
fun fromFormParams(params: Map<String, String>): SIOPv2Response {
val vpTokenStr = params["vp_token"] ?: throw Exception("vp_token parameter must be set")
val presentationSubmissionStr =
params["presentation_submission"] ?: throw Exception("presentation_submission parameter must be set")
val idToken = params["id_token"]
val presentationSubmissionStr = params["presentation_submission"]
return SIOPv2Response(
vp_token = OIDCUtils.fromVpToken(vpTokenStr),
presentation_submission = KlaxonWithConverters().parse<PresentationSubmission>(presentationSubmissionStr)
presentation_submission = presentationSubmissionStr?.let { KlaxonWithConverters().parse<PresentationSubmission>(it) }
?: idToken?.let { IDToken.parse(it)?.vpTokenRef?.presentation_submission }
?: throw Exception("Could not parse presentation_submission parameter"),
id_token = params["id_token"],
id_token = idToken,
state = params["state"]
)
}
Expand Down

0 comments on commit 600d815

Please sign in to comment.