From 826d7a3b0099aa87bbabad33593e1d3a2abb8759 Mon Sep 17 00:00:00 2001 From: Jose Luis Crisostomo Date: Fri, 4 Oct 2024 11:37:07 +0200 Subject: [PATCH 1/3] adding PAR object --- .../ec/eudi/wallet/issue/openidvci/PARResponse.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openidvci/PARResponse.kt diff --git a/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openidvci/PARResponse.kt b/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openidvci/PARResponse.kt new file mode 100644 index 00000000..460883e1 --- /dev/null +++ b/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openidvci/PARResponse.kt @@ -0,0 +1,14 @@ +package eu.europa.ec.eudi.wallet.issue.openidvci + +import java.net.URL + +data class PARResponse ( + val authorizationCodeURL: URL, + val pkceVerifier: PKCEVerifier, + val state: String, +) + +data class PKCEVerifier( + val codeVerifier: String, + val codeVerifierMethod: String, +) \ No newline at end of file From 980f6328e7b46b99f449d7b0803e8fbea56112e2 Mon Sep 17 00:00:00 2001 From: Jose Luis Crisostomo Date: Fri, 4 Oct 2024 11:39:04 +0200 Subject: [PATCH 2/3] separate performPushAuthorizationRequest call --- .../issue/openid4vci/DefaultOpenId4VciManager.kt | 14 +++++++++++++- .../wallet/issue/openid4vci/IssuerAuthorization.kt | 4 ++++ .../wallet/issue/openid4vci/OpenId4VciManager.kt | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/DefaultOpenId4VciManager.kt b/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/DefaultOpenId4VciManager.kt index 0ffb0fb0..ee5b869e 100644 --- a/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/DefaultOpenId4VciManager.kt +++ b/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/DefaultOpenId4VciManager.kt @@ -21,6 +21,8 @@ import android.net.Uri import eu.europa.ec.eudi.openid4vci.DefaultHttpClientFactory import eu.europa.ec.eudi.openid4vci.DeferredIssuer import eu.europa.ec.eudi.wallet.document.* +import eu.europa.ec.eudi.wallet.issue.openidvci.PARResponse +import eu.europa.ec.eudi.wallet.issue.openidvci.PKCEVerifier import eu.europa.ec.eudi.wallet.internal.mainExecutor import eu.europa.ec.eudi.wallet.issue.openid4vci.IssueEvent.Companion.failure import eu.europa.ec.eudi.wallet.logging.Logger @@ -187,6 +189,17 @@ internal class DefaultOpenId4VciManager( resumeWithAuthorization(Uri.parse(uri)) } + override suspend fun performPushAuthorizationRequest(docType: String): PARResponse { + val offer = offerCreator.createOffer(docType) + val issuer = issuerCreator.createIssuer(offer) + val parResponse = issuerAuthorization.performPushAuthorizationRequest(issuer) + return PARResponse( + authorizationCodeURL = parResponse.authorizationCodeURL.value, + pkceVerifier = PKCEVerifier(codeVerifier = parResponse.pkceVerifier.codeVerifier, codeVerifierMethod = parResponse.pkceVerifier.codeVerifierMethod), + state = parResponse.state + ) + } + /** * Issues the given [Offer]. */ @@ -195,7 +208,6 @@ internal class DefaultOpenId4VciManager( txCode: String?, listener: OpenId4VciManager.OnResult, ) { - offer as DefaultOffer val issuer = issuerCreator.createIssuer(offer) var authorizedRequest = issuerAuthorization.authorize(issuer, txCode) listener(IssueEvent.Started(offer.offeredDocuments.size)) diff --git a/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/IssuerAuthorization.kt b/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/IssuerAuthorization.kt index 9aef4225..51ef3a30 100644 --- a/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/IssuerAuthorization.kt +++ b/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/IssuerAuthorization.kt @@ -44,6 +44,10 @@ internal class IssuerAuthorization( var continuation: CancellableContinuation>? = null + suspend fun performPushAuthorizationRequest(issuer: Issuer): AuthorizationRequestPrepared { + return issuer.prepareAuthorizationRequest().getOrThrow() + } + /** * Authorizes the given [Issuer] and returns the authorized request. * If txCode is provided, it will be used to authorize the issuer, diff --git a/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/OpenId4VciManager.kt b/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/OpenId4VciManager.kt index 60f66928..67f539b7 100644 --- a/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/OpenId4VciManager.kt +++ b/wallet-core/src/main/java/eu/europa/ec/eudi/wallet/issue/openid4vci/OpenId4VciManager.kt @@ -19,11 +19,13 @@ package eu.europa.ec.eudi.wallet.issue.openid4vci import android.content.Context import android.net.Uri import androidx.annotation.IntDef +import eu.europa.ec.eudi.openid4vci.AuthorizationRequestPrepared import eu.europa.ec.eudi.wallet.document.DeferredDocument import eu.europa.ec.eudi.wallet.document.DocumentManager import eu.europa.ec.eudi.wallet.issue.openid4vci.OpenId4VciManager.Config.ParUsage.Companion.IF_SUPPORTED import eu.europa.ec.eudi.wallet.issue.openid4vci.OpenId4VciManager.Config.ParUsage.Companion.NEVER import eu.europa.ec.eudi.wallet.issue.openid4vci.OpenId4VciManager.Config.ParUsage.Companion.REQUIRED +import eu.europa.ec.eudi.wallet.issue.openidvci.PARResponse import eu.europa.ec.eudi.wallet.logging.Logger import io.ktor.client.* import java.util.concurrent.Executor @@ -377,4 +379,6 @@ interface OpenId4VciManager { fun make(block: Builder.() -> Unit) = Builder().apply(block).build() } } + + suspend fun performPushAuthorizationRequest(docType: String): PARResponse } \ No newline at end of file From f232f9116c01fe2f641ff046faa1b093c7073451 Mon Sep 17 00:00:00 2001 From: Jose Luis Crisostomo Date: Fri, 4 Oct 2024 14:41:59 +0200 Subject: [PATCH 3/3] updating maven config --- gradle.properties | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 0fecddb2..3b89816a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -42,7 +42,7 @@ systemProp.sonar.host.url=https://sonarcloud.io systemProp.sonar.gradle.skipCompile=true systemProp.sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/testDebugUnitTestCoverage/testDebugUnitTestCoverage.xml,build/reports/jacoco/testReleaseUnitTestCoverage/testReleaseUnitTestCoverage.xml systemProp.sonar.projectName=eudi-lib-android-wallet-core -VERSION_NAME=0.11.1-SNAPSHOT +VERSION_NAME=0.0.1-SNAPSHOT SONATYPE_HOST=S01 SONATYPE_AUTOMATIC_RELEASE=false @@ -55,12 +55,12 @@ POM_ARTIFACT_ID=eudi-lib-android-wallet-core POM_NAME=eudi-lib-android-wallet-core POM_DESCRIPTION=EUDI Wallet Core library for Android -POM_URL=https://github.com/eu-digital-identity-wallet/eudi-lib-android-wallet-core +POM_URL=https://github.com/german-first-iteration/eudi-lib-android-wallet-core POM_LICENSE_NAME=The Apache License, Version 2.0 POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt -POM_SCM_URL=https://github.com/eu-digital-identity-wallet/eudi-lib-android-wallet-core -POM_SCM_CONNECTION=scm:git:git@github.com:eu-digital-identity-wallet/eudi-lib-android-wallet-core.git' -POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com:eu-digital-identity-wallet/eudi-lib-android-wallet-core.git' +POM_SCM_URL=https://github.com/german-first-iteration/eudi-lib-android-wallet-core +POM_SCM_CONNECTION=scm:git:git@github.com:german-first-iteration/eudi-lib-android-wallet-core.git +POM_SCM_DEV_CONNECTION=scm:git:ssh://github.com:german-first-iteration/eudi-lib-android-wallet-core.git POM_ISSUE_SYSTEM=github -POM_ISSUE_URL=https://github.com/eu-digital-identity-wallet/eudi-lib-android-wallet-core/issues -POM_DEVELOPER_URL=https://github.com/eu-digital-identity-wallet \ No newline at end of file +POM_ISSUE_URL=https://github.com/german-first-iteration/eudi-lib-android-wallet-core/issues +POM_DEVELOPER_URL=https://github.com/german-first-iteration \ No newline at end of file