Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First draft of new Issuer constructed always around a specific creden… #127

Merged
merged 9 commits into from
Feb 15, 2024
Merged

Conversation

vafeini
Copy link
Contributor

@vafeini vafeini commented Jan 24, 2024

…tial offer.

closes #50

@vafeini vafeini requested a review from a team as a code owner January 24, 2024 13:06
@babisRoutis babisRoutis self-requested a review January 25, 2024 08:36
import eu.europa.ec.eudi.openid4vci.internal.KeyGenerator
import io.ktor.client.*

interface Issuer2 : AuthorizeIssuance2, RequestIssuance, QueryForDeferredCredential {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issuer2 is not the best name, should we intend to merge this pull request any time soon.
That is, if we keep Issuer & Issuer2 in the same codebase we have to rename Issuer2

Perhaps, something like CredentialOfferBasedIssuer or simply OfferBasedIssuer & OfferBasedAuthorizer. Not particularly nice though.

src/main/kotlin/eu/europa/ec/eudi/openid4vci/Issuer2.kt Outdated Show resolved Hide resolved
@@ -0,0 +1,75 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for an impl package.

internal is the impl

src/main/kotlin/eu/europa/ec/eudi/openid4vci/Issuer2.kt Outdated Show resolved Hide resolved
suspend fun metaData(
httpClient: HttpClient,
credentialIssuerId: CredentialIssuerId,
): Pair<CredentialIssuerMetadata, List<CIAuthorizationServerMetadata>> =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider running auth resolutions in parallel. For example

suspend fun metaData(
            httpClient: HttpClient,
            credentialIssuerId: CredentialIssuerId,
        ): Pair<CredentialIssuerMetadata, List<CIAuthorizationServerMetadata>> = coroutineScope {
            with(httpClient) {
                val issuerMetadata = run {
                    val resolver = DefaultCredentialIssuerMetadataResolver(httpClient)
                    resolver.resolve(credentialIssuerId).getOrThrow()
                }
                val authorizationServersMetadata =
                    issuerMetadata.authorizationServers.distinct().map { authServerUrl ->
                        async {
                            val resolver = DefaultAuthorizationServerMetadataResolver(httpClient)
                            resolver.resolve(authServerUrl).getOrNull()
                        }
                    }.awaitAll().filterNotNull()
                checkNotNull(authorizationServersMetadata.isNotEmpty()) {
                    "Unable to obtain authorization server metadata"
                }
                issuerMetadata to authorizationServersMetadata
            }
        }

README.md Outdated
@@ -71,14 +71,14 @@ val resolver = AuthorizationServerMetadataResolver() // get a default implementa
val metadata: CIAuthorizationServerMetadata = resolver.resolve(HttpsUrl("https://...")).getOrThrow() // fetch and parse authorization server metadata
```

There is also a convenient method that obtains the credentials issuer metadata & the metadata of the first
authorization server with a single call
There is also a convenient method that obtains the credentials issuer metadata & the metadata of all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this section should not be the first one.
I would recommend keeping the diagram first, then the Issuer initialization and usage and at the end - for completeness - add the section for the resolvers

@babisRoutis babisRoutis merged commit eda93f0 into eu-digital-identity-wallet:main Feb 15, 2024
3 checks passed
@babisRoutis babisRoutis deleted the feat/issuer2 branch February 15, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PIN must be present when offer defines as such in the 'pre-authorized_code' grand
2 participants