-
Notifications
You must be signed in to change notification settings - Fork 7
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
First draft of new Issuer constructed always around a specific creden… #127
Conversation
import eu.europa.ec.eudi.openid4vci.internal.KeyGenerator | ||
import io.ktor.client.* | ||
|
||
interface Issuer2 : AuthorizeIssuance2, RequestIssuance, QueryForDeferredCredential { |
There was a problem hiding this comment.
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.
@@ -0,0 +1,75 @@ | |||
/* |
There was a problem hiding this comment.
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
suspend fun metaData( | ||
httpClient: HttpClient, | ||
credentialIssuerId: CredentialIssuerId, | ||
): Pair<CredentialIssuerMetadata, List<CIAuthorizationServerMetadata>> = |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
…tial offer.
closes #50