Skip to content

Commit

Permalink
Handle auth server metadata from the credential offer
Browse files Browse the repository at this point in the history
  • Loading branch information
QZHelen committed Jan 8, 2025
1 parent 35c7201 commit 252d7e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.credman.cmwallet.openid4vci

import android.util.Log
import com.credman.cmwallet.createJWTES256
import com.credman.cmwallet.openid4vci.data.CredentialOffer
import com.credman.cmwallet.openid4vci.data.CredentialRequest
Expand Down Expand Up @@ -47,6 +48,9 @@ class OpenId4VCI(val credentialOfferJson: String) {
}

suspend fun requestAuthServerMetadata(server: String): OauthAuthorizationServer {
if (credentialOffer.authorizationServerMetadata != null) {
return credentialOffer.authorizationServerMetadata
}
if (server !in authServerCache) {
authServerCache[server] =
httpClient.get("$server/.well-known/oauth-authorization-server").body()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,6 @@ data class CredentialOffer(
@SerialName("credential_issuer") val credentialIssuer: String,
@SerialName("credential_configuration_ids") val credentialConfigurationIds: List<String>,
@SerialName("grants") val grants: Grants?,
@SerialName("issuer_metadata") val issuerMetadata: CredentialIssuerMetadata
@SerialName("issuer_metadata") val issuerMetadata: CredentialIssuerMetadata,
@SerialName("authorization_server_metadata") val authorizationServerMetadata: OauthAuthorizationServer?
)

0 comments on commit 252d7e1

Please sign in to comment.