Skip to content

Commit

Permalink
Reorganize OAUTH2 & Credential Issuer HTTP clients (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
babisRoutis authored May 1, 2024
1 parent ced7a9a commit 5898723
Show file tree
Hide file tree
Showing 21 changed files with 1,030 additions and 963 deletions.
12 changes: 9 additions & 3 deletions src/main/kotlin/eu/europa/ec/eudi/openid4vci/Issuer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package eu.europa.ec.eudi.openid4vci

import eu.europa.ec.eudi.openid4vci.internal.*
import eu.europa.ec.eudi.openid4vci.internal.RequestIssuanceImpl
import eu.europa.ec.eudi.openid4vci.internal.http.IssuanceServerClient
import io.ktor.client.*
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
Expand Down Expand Up @@ -92,13 +93,18 @@ interface Issuer : AuthorizeIssuance, RequestIssuance, QueryForDeferredCredentia
ktorHttpClientFactory,
dPoPJwtFactory,
)
val responseEncryptionSpec =
responseEncryptionSpec(credentialOffer, config, responseEncryptionSpecFactory).getOrThrow()
val requestIssuance = RequestIssuanceImpl(
credentialOffer,
config,
issuanceServerClient,
responseEncryptionSpecFactory,
).getOrThrow()
val queryForDeferredCredential = QueryForDeferredCredentialImpl(issuanceServerClient)
responseEncryptionSpec,
)
val queryForDeferredCredential = QueryForDeferredCredentialImpl(
issuanceServerClient,
responseEncryptionSpec,
)
val notifyIssuer = NotifyIssuerImpl(issuanceServerClient)

object :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ package eu.europa.ec.eudi.openid4vci.internal
import com.nimbusds.oauth2.sdk.id.State
import eu.europa.ec.eudi.openid4vci.*
import eu.europa.ec.eudi.openid4vci.CredentialIssuanceError.*
import eu.europa.ec.eudi.openid4vci.internal.http.AuthorizationServerClient

internal data class TokenResponse(
val accessToken: AccessToken,
val refreshToken: RefreshToken?,
val cNonce: CNonce?,
val authorizationDetails: Map<CredentialConfigurationIdentifier, List<CredentialIdentifier>> = emptyMap(),
)

internal class AuthorizeIssuanceImpl(
private val credentialOffer: CredentialOffer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.europa.ec.eudi.openid4vci.internal.formats
package eu.europa.ec.eudi.openid4vci.internal

import eu.europa.ec.eudi.openid4vci.*
import eu.europa.ec.eudi.openid4vci.CredentialIssuanceError.InvalidIssuanceRequest
import eu.europa.ec.eudi.openid4vci.internal.Proof
import eu.europa.ec.eudi.openid4vci.internal.ensure
import eu.europa.ec.eudi.openid4vci.internal.ensureNotNull

internal sealed interface CredentialType {
data class MsoMdocDocType(val doctype: String, val claimSet: MsoMdocClaimSet?) : CredentialType
Expand All @@ -34,6 +31,8 @@ internal sealed interface CredentialType {
*/
internal sealed interface CredentialIssuanceRequest {

val encryption: IssuanceResponseEncryptionSpec?

/**
* Models an issuance request for a batch of credentials
*
Expand All @@ -43,14 +42,14 @@ internal sealed interface CredentialIssuanceRequest {
*/
data class BatchRequest(
val credentialRequests: List<SingleRequest>,
override val encryption: IssuanceResponseEncryptionSpec?,
) : CredentialIssuanceRequest

/**
* Sealed hierarchy of credential issuance requests.
*/
sealed interface SingleRequest : CredentialIssuanceRequest {
val proof: Proof?
val encryption: IssuanceResponseEncryptionSpec?
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import eu.europa.ec.eudi.openid4vci.CredentialIssuerMetadata
import eu.europa.ec.eudi.openid4vci.CredentialIssuerMetadataError
import eu.europa.ec.eudi.openid4vci.CredentialIssuerMetadataResolver
import eu.europa.ec.eudi.openid4vci.CredentialIssuerMetadataValidationError.InvalidCredentialIssuerId
import eu.europa.ec.eudi.openid4vci.internal.formats.CredentialIssuerMetadataJsonParser
import eu.europa.ec.eudi.openid4vci.internal.http.CredentialIssuerMetadataJsonParser
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.request.*
Expand Down
Loading

0 comments on commit 5898723

Please sign in to comment.