From a6c325952e4d1e63b6effe8b007aab09f0868dcc Mon Sep 17 00:00:00 2001 From: Simon Mueller Date: Mon, 7 Oct 2024 13:54:44 +0200 Subject: [PATCH] Update Readme --- CHANGELOG.md | 3 +++ .../wallet/lib/oidc/helper/RequestParser.kt | 14 ++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25d78be8..f3ca4255 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ Release 5.1.0: - tbd + - New Class `SignatureRequestFrom` to handle signature requests by reference + - Rename `AuthenticationRequestParser` to `RequestParser` + - `RequestParser` can now handle `SignatureRequestFrom` Release 5.0.0: - Remove `OidcSiopWallet.newDefaultInstance()` and replace it with a constructor diff --git a/vck-openid/src/commonMain/kotlin/at/asitplus/wallet/lib/oidc/helper/RequestParser.kt b/vck-openid/src/commonMain/kotlin/at/asitplus/wallet/lib/oidc/helper/RequestParser.kt index 3b947704..ad496ac1 100644 --- a/vck-openid/src/commonMain/kotlin/at/asitplus/wallet/lib/oidc/helper/RequestParser.kt +++ b/vck-openid/src/commonMain/kotlin/at/asitplus/wallet/lib/oidc/helper/RequestParser.kt @@ -28,7 +28,7 @@ import kotlinx.serialization.json.JsonObject class RequestParser( /** * Need to implement if resources are defined by reference, i.e. the URL for a [JsonWebKeySet], - * or the authentication request itself as `request_uri`, or `presentation_definition_uri`. + * or the request itself as `request_uri`, or `presentation_definition_uri`. * Implementations need to fetch the url passed in, and return either the body, if there is one, * or the HTTP header `Location`, i.e. if the server sends the request object as a redirect. */ @@ -50,7 +50,7 @@ class RequestParser( } /** - * Pass in the URL sent by the Verifier (containing the [AuthenticationRequestParameters] as query parameters), + * Pass in the URL sent by the Verifier (containing the [RequestParameters] as query parameters), * to create [AuthenticationResponseParameters] that can be sent back to the Verifier, see * [AuthenticationResponseResult]. */ @@ -68,7 +68,6 @@ class RequestParser( SignatureRequestParametersFrom.Uri(it, result) } } -// } }.onFailure { it.printStackTrace() }.getOrNull() ?: catching { // maybe it is already a JSON string when (val params = jsonSerializer.decodeFromString(RequestParametersSerializer, input)) { @@ -83,11 +82,10 @@ class RequestParser( .also { Napier.w("Could not parse authentication request: $input") } val extractedParams = - (parsedParams.parameters as? AuthenticationRequestParameters)?.let { - extractRequestObject(it) - } ?: parsedParams - .also { Napier.i("Parsed authentication request: $it") } - extractedParams + (parsedParams.parameters as? AuthenticationRequestParameters)?.let { extractRequestObject(it) } + ?: parsedParams + + extractedParams.also { Napier.i("Parsed authentication request: $it") } } private suspend fun extractRequestObject(params: AuthenticationRequestParameters): RequestParametersFrom? =