-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix overriding ktorHttpClientFactory in EudiWallet object for openId4…
…Vci and openId4Vp; fix don't delete deferred documents if deferred issuing fails
- Loading branch information
1 parent
327c006
commit 9dc119d
Showing
15 changed files
with
132 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
...allet.issue.openid4vci/-open-id4-vci-manager/-builder/kt-http-client-factory.md
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
wallet-core/src/main/java/eu/europa/ec/eudi/wallet/util/KtorHttpClientFactoryExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright (c) 2024 European Commission | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package eu.europa.ec.eudi.wallet.util | ||
|
||
import eu.europa.ec.eudi.wallet.issue.openid4vci.OpenId4VciManager.Companion.TAG | ||
import eu.europa.ec.eudi.wallet.logging.Logger | ||
import io.ktor.client.* | ||
import io.ktor.client.plugins.contentnegotiation.* | ||
import io.ktor.client.plugins.logging.* | ||
import io.ktor.serialization.kotlinx.json.* | ||
import kotlinx.serialization.json.Json | ||
|
||
/** | ||
* Wraps the [HttpClient] with a logging interceptor. | ||
* @receiver the [HttpClient] factory | ||
* @param libraryLogger the logger | ||
* @return the wrapped [HttpClient] factory | ||
*/ | ||
@JvmSynthetic | ||
internal fun (() -> HttpClient).wrappedWithLogging(libraryLogger: Logger?): (() -> HttpClient) { | ||
return if (libraryLogger != null) { | ||
{ | ||
val ktorLogger = object : io.ktor.client.plugins.logging.Logger { | ||
override fun log(message: String) { | ||
libraryLogger.d(TAG, message) | ||
} | ||
} | ||
this().let { client -> | ||
client.config { | ||
install(Logging) { | ||
logger = ktorLogger | ||
level = LogLevel.ALL | ||
} | ||
} | ||
} | ||
} | ||
} else this | ||
} | ||
|
||
@JvmSynthetic | ||
internal fun (() -> HttpClient).wrappedWithContentNegotiation(): (() -> HttpClient) { | ||
return { | ||
val jsonSupport = Json { | ||
ignoreUnknownKeys = true | ||
prettyPrint = true | ||
} | ||
this().let { client -> | ||
client.config { | ||
install(ContentNegotiation) { | ||
json( | ||
json = jsonSupport, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.