@@ -10,17 +10,12 @@ import at.asitplus.openid.JwtVcIssuerMetadata
1010import at.asitplus.openid.OidcUserInfoExtended
1111import at.asitplus.openid.OpenIdConstants
1212import at.asitplus.openid.SupportedAlgorithmsContainer
13- import at.asitplus.signum.indispensable.CryptoPublicKey
1413import at.asitplus.signum.indispensable.SignatureAlgorithm
1514import at.asitplus.signum.indispensable.josef.JsonWebKeySet
1615import at.asitplus.signum.indispensable.josef.JweAlgorithm
1716import at.asitplus.signum.indispensable.josef.JweEncryption
1817import at.asitplus.signum.indispensable.josef.JweHeader
19- import at.asitplus.signum.indispensable.josef.JwsAlgorithm
20- import at.asitplus.signum.indispensable.josef.JwsSigned
21- import at.asitplus.signum.indispensable.josef.KeyAttestationJwt
2218import at.asitplus.signum.indispensable.josef.toJwsAlgorithm
23- import at.asitplus.wallet.lib.agent.CredentialToBeIssued
2419import at.asitplus.wallet.lib.agent.EphemeralKeyWithoutCert
2520import at.asitplus.wallet.lib.agent.Issuer
2621import at.asitplus.wallet.lib.agent.IssuerAgent
@@ -29,18 +24,12 @@ import at.asitplus.wallet.lib.data.ConstantIndex
2924import at.asitplus.wallet.lib.data.ConstantIndex.CredentialScheme
3025import at.asitplus.wallet.lib.jws.EncryptJwe
3126import at.asitplus.wallet.lib.jws.EncryptJweFun
32- import at.asitplus.wallet.lib.jws.VerifyJwsObject
33- import at.asitplus.wallet.lib.jws.VerifyJwsObjectFun
3427import at.asitplus.wallet.lib.oauth2.RequestInfo
3528import at.asitplus.wallet.lib.oidvci.CredentialSchemeMapping.decodeFromCredentialIdentifier
3629import at.asitplus.wallet.lib.oidvci.CredentialSchemeMapping.toSupportedCredentialFormat
3730import at.asitplus.wallet.lib.oidvci.OAuth2Exception.*
3831import io.github.aakira.napier.Napier
39- import kotlin.time.Clock
40- import kotlin.time.Clock.System
4132import kotlin.coroutines.cancellation.CancellationException
42- import kotlin.time.Duration
43- import kotlin.time.Duration.Companion.minutes
4433
4534/* *
4635 * Server implementation to issue credentials using OID4VCI.
@@ -72,23 +61,8 @@ class CredentialIssuer(
7261 * to that URI (which starts with [publicContext]) to [nonce].
7362 */
7463 private val nonceEndpointPath : String = " /nonce" ,
75- @Suppress(" DEPRECATION" ) @Deprecated(" Use `credentialDataProvider` in method `credential` instead" )
76- private val credentialProvider : CredentialIssuerDataProvider = FallbackCredentialIssuerDataProvider (),
77- /* * Used to verify the signature of proof elements in credential requests. */
78- @Deprecated(" Use `proofValidator` instead" )
79- private val verifyJwsObject : VerifyJwsObjectFun = VerifyJwsObject (),
80- @Deprecated(" Use `proofValidator` instead" )
81- private val supportedAlgorithms : Collection <JwsAlgorithm .Signature > = listOf(JwsAlgorithm .Signature .ES256 ),
82- @Deprecated(" Use `proofValidator` instead" )
83- private val clock : Clock = System ,
84- @Deprecated(" Use `proofValidator` instead" )
85- private val timeLeeway : Duration = 5 .minutes,
86- @Deprecated(" Use `proofValidator` instead" )
87- private val verifyAttestationProof : (JwsSigned <KeyAttestationJwt >) -> Boolean = { true },
8864 /* * Turn on to require key attestation support in the [metadata]. */
8965 private val requireKeyAttestation : Boolean = false ,
90- @Deprecated(" Use `proofValidator` instead" )
91- private val clientNonceService : NonceService = DefaultNonceService (),
9266 /* * Used to optionally encrypt the credential response, if requested by the client. */
9367 private val encryptCredentialRequest : EncryptJweFun = EncryptJwe (EphemeralKeyWithoutCert ()),
9468 /* * Whether to indicate in [metadata] if credential response encryption is required. */
@@ -100,13 +74,7 @@ class CredentialIssuer(
10074 /* * Used to verify proof of posession of key material in credential requests. */
10175 private val proofValidator : ProofValidator = ProofValidator (
10276 publicContext = publicContext,
103- verifyJwsObject = verifyJwsObject,
104- supportedAlgorithms = supportedAlgorithms,
105- clock = clock,
106- timeLeeway = timeLeeway,
107- verifyAttestationProof = verifyAttestationProof,
10877 requireKeyAttestation = requireKeyAttestation,
109- clientNonceService = clientNonceService,
11078 ),
11179) {
11280 private val supportedSigningAlgorithms = cryptoAlgorithms
@@ -167,31 +135,6 @@ class CredentialIssuer(
167135 */
168136 suspend fun nonce () = proofValidator.nonce()
169137
170- /* *
171- * Verifies the [authorizationHeader] to contain a token from [authorizationService],
172- * verifies the proof sent by the client (must contain a nonce sent from [authorizationService]),
173- * and issues credentials to the client.
174- *
175- * Callers need to send the result JSON-serialized back to the client.
176- * HTTP status code MUST be 202.
177- *
178- * @param authorizationHeader value of HTTP header `Authorization` sent by the client, with all prefixes
179- * @param params Parameters the client sent JSON-serialized in the HTTP body
180- * @param request information about the HTTP request the client has made, to validate authentication
181- */
182- @Suppress(" DEPRECATION" )
183- @Deprecated(" Use `credential` with parameter `credentialDataProvider` instead" )
184- suspend fun credential (
185- authorizationHeader : String ,
186- params : CredentialRequestParameters ,
187- request : RequestInfo ? = null,
188- ): KmmResult <CredentialResponseParameters > = credential(
189- authorizationHeader = authorizationHeader,
190- params = params,
191- credentialDataProvider = CredentialIssuerDataProviderAdapter (credentialProvider),
192- request = request,
193- )
194-
195138 /* *
196139 * Verifies the [authorizationHeader] to contain a token from [authorizationService],
197140 * verifies the proof sent by the client (must contain a nonce sent from [authorizationService]),
@@ -296,40 +239,3 @@ class CredentialIssuer(
296239 }
297240
298241}
299-
300- @Deprecated(" Use `CredentialDataProviderFun` instead" )
301- fun interface CredentialIssuerDataProvider {
302-
303- /* *
304- * Gets called with the user authorized in [userInfo],
305- * a resolved [credentialScheme],
306- * the holder key in [subjectPublicKey],
307- * and the requested credential [representation].
308- * Callers may optionally define some attribute names from [ConstantIndex.CredentialScheme.claimNames] in
309- * [claimNames] to request only some claims (if supported by the representation).
310- */
311- fun getCredential (
312- userInfo : OidcUserInfoExtended ,
313- subjectPublicKey : CryptoPublicKey ,
314- credentialScheme : CredentialScheme ,
315- representation : ConstantIndex .CredentialRepresentation ,
316- claimNames : Collection <String >? ,
317- ): KmmResult <CredentialToBeIssued >
318- }
319-
320- /* * Fallback for deprecated constructor parameter, which should never be called, because when clients
321- * migrate away from deprecated code, it's never used from our code,
322- * when not, clients did set a correct implementation and that one is used. */
323- @Suppress(" DEPRECATION" )
324- private class FallbackCredentialIssuerDataProvider : CredentialIssuerDataProvider {
325- override fun getCredential (
326- userInfo : OidcUserInfoExtended ,
327- subjectPublicKey : CryptoPublicKey ,
328- credentialScheme : CredentialScheme ,
329- representation : ConstantIndex .CredentialRepresentation ,
330- claimNames : Collection <String >? ,
331- ): KmmResult <CredentialToBeIssued > = catching {
332- TODO ()
333- }
334-
335- }
0 commit comments