Skip to content

Commit

Permalink
Update dependencies, fix build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
waltkb committed Feb 17, 2025
1 parent 308229f commit 6c617fc
Show file tree
Hide file tree
Showing 157 changed files with 1,008 additions and 1,085 deletions.
26 changes: 13 additions & 13 deletions .run/Verifier.run.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Verifier" type="JetRunConfigurationType">
<option name="ALTERNATIVE_JRE_PATH" value="17"/>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true"/>
<option name="MAIN_CLASS_NAME" value="id.walt.verifier.MainKt"/>
<module name="id.walt.waltid-identity.waltid-services.waltid-verifier-api.main"/>
<option name="PROGRAM_PARAMETERS" value="-l trace"/>
<shortenClasspath name="NONE"/>
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/waltid-services/waltid-verifier-api"/>
<method v="2">
<option name="Make" enabled="true"/>
</method>
</configuration>
</component>
<configuration default="false" name="Verifier" type="JetRunConfigurationType">
<option name="ALTERNATIVE_JRE_PATH" value="17" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="id.walt.verifier.MainKt" />
<module name="waltid-identity.waltid-services.waltid-verifier-api.main" />
<option name="PROGRAM_PARAMETERS" value="-l trace" />
<shortenClasspath name="NONE" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/waltid-services/waltid-verifier-api" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ plugins {

kotlin("plugin.serialization") version kotlinVersion apply false

id("love.forte.plugin.suspend-transform") version "2.1.0-0.10.1" apply false
id("love.forte.plugin.suspend-transform") version "2.1.0-0.11.0" apply false
id("com.android.library") version "8.7.3" apply false
id("com.android.application") version "8.7.3" apply false

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 1 addition & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
7 changes: 4 additions & 3 deletions waltid-applications/waltid-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
kotlin("android")
kotlin("plugin.serialization")
kotlin("plugin.compose")
id("com.github.ben-manes.versions")
}

android {
Expand Down Expand Up @@ -57,15 +58,15 @@ dependencies {
api(project(":waltid-libraries:sdjwt:waltid-sdjwt"))

// JSON
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")

// -- Android --
implementation("androidx.biometric:biometric:1.2.0-alpha05")
implementation("androidx.biometric:biometric-ktx:1.2.0-alpha05")
implementation("androidx.navigation:navigation-compose:2.7.7")
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.3")
implementation("androidx.activity:activity-compose:1.9.0")
implementation("androidx.activity:activity-compose:1.10.1")

// Compose
implementation(platform("androidx.compose:compose-bom:2024.02.01"))
Expand All @@ -77,7 +78,7 @@ dependencies {

// Testing
testImplementation(kotlin("test"))
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.1")
testImplementation("junit:junit:4.13.2")
testImplementation("androidx.test.ext:junit:1.2.1")
testImplementation("androidx.test.espresso:espresso-core:3.6.1")
Expand Down
20 changes: 10 additions & 10 deletions waltid-applications/waltid-cli/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

object Versions {
const val KTOR_VERSION = "2.3.12"
const val KTOR_VERSION = "3.1.0"
}

plugins {
kotlin("multiplatform")
kotlin("plugin.serialization")
id("maven-publish")
id("com.github.ben-manes.versions")
id("io.ktor.plugin") version "2.3.12" // Versions.KTOR_VERSION
id("io.ktor.plugin") version "3.1.0" // Versions.KTOR_VERSION
// Apply the application plugin to add support for building a CLI application in Java.
application
}
Expand Down Expand Up @@ -65,25 +65,25 @@ kotlin {
api(project(":waltid-libraries:sdjwt:waltid-sdjwt"))
api(project(":waltid-libraries:protocols:waltid-openid4vc"))

implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.2")
implementation("com.google.code.gson:gson:2.11.0")

// CLI
implementation("com.github.ajalt.mordant:mordant:2.7.1")
implementation("com.github.ajalt.clikt:clikt:4.4.0")

// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")

// Logging
implementation("io.github.oshai:kotlin-logging:7.0.0")
implementation("io.github.oshai:kotlin-logging:7.0.4")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.1")
}
}
val jvmMain by getting {
Expand All @@ -95,15 +95,15 @@ kotlin {
implementation("com.nimbusds:nimbus-jose-jwt:9.41.1")

// BouncyCastle for PEM import
implementation("org.bouncycastle:bcpkix-lts8on:2.73.6")
implementation("org.bouncycastle:bcpkix-lts8on:2.73.7")
}
}
val jvmTest by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
implementation("com.wolpl.clikt-testkit:clikt-testkit:2.0.0")

implementation("org.junit.jupiter:junit-jupiter-params:5.11.0")
implementation("org.junit.jupiter:junit-jupiter-params:5.11.4")

// Ktor server
implementation("io.ktor:ktor-server-core-jvm:${Versions.KTOR_VERSION}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class WaltIdVCVerifyCmdTest {

val schemaFilePath = "${resourcesPath}/schema/OpenBadgeV3_schema.json"

private val webhookTestServer: NettyApplicationEngine
private val webhookTestServer: EmbeddedServer<NettyApplicationEngine, NettyApplicationEngine.Configuration>
private val webhookTestServerURL: String
private val webhookTestServerSuccessURL: String
private val webhookTestServerFailURL: String
Expand All @@ -78,8 +78,8 @@ class WaltIdVCVerifyCmdTest {
}
}.start(false)
runBlocking {
url = "http://" + webhookTestServer.resolvedConnectors()
.first().host + ":${webhookTestServer.resolvedConnectors().first().port}"
url = "http://" + webhookTestServer.engine.resolvedConnectors()
.first().host + ":${webhookTestServer.engine.resolvedConnectors().first().port}"
}
webhookTestServerURL = url
webhookTestServerSuccessURL = "$webhookTestServerURL/success"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ kotlin {
}

sourceSets {
val ktor_version = "2.3.12"
val ktor_version = "3.1.0"

commonMain.dependencies {
implementation(project(":waltid-libraries:sdjwt:waltid-sdjwt"))
Expand Down Expand Up @@ -53,7 +53,7 @@ kotlin {
iosSimulatorArm64Main.dependsOn(this)
dependencies {
implementation(project(":waltid-libraries:crypto:waltid-crypto-ios"))
implementation("io.ktor:ktor-client-darwin:2.3.12")
implementation("io.ktor:ktor-client-darwin:3.1.0")
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions waltid-libraries/auth/waltid-idpkit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
kotlin("jvm")
id("io.ktor.plugin") version "2.3.12"
id("io.ktor.plugin") version "3.1.0"
kotlin("plugin.serialization")
id("maven-publish")

Expand Down Expand Up @@ -38,23 +38,23 @@ dependencies {
implementation("io.ktor:ktor-client-content-negotiation")

// JSON
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.2")
implementation("com.eygraber:jsonpathkt-kotlinx:3.0.2")

// OIDC
implementation("com.nimbusds:oauth2-oidc-sdk:11.12")
implementation("com.nimbusds:nimbus-jose-jwt:9.41.1")

// for Ed25519
implementation("com.google.crypto.tink:tink:1.15.0") {
implementation("com.google.crypto.tink:tink:1.16.0") {
exclude("org.slf4j.simple")
}


// Logging
implementation("io.klogging:klogging-jvm:0.7.2")
implementation("io.klogging:slf4j-klogging:0.7.2")
implementation("io.klogging:klogging-jvm:0.9.1")
implementation("io.klogging:slf4j-klogging:0.9.1")

testImplementation("io.ktor:ktor-server-test-host-jvm")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import io.ktor.serialization.kotlinx.json.*
import io.ktor.server.application.*
import io.ktor.server.cio.*
import io.ktor.server.engine.*
import io.ktor.server.plugins.callloging.*
import io.ktor.server.plugins.calllogging.CallLogging
import io.ktor.server.plugins.contentnegotiation.*
import io.ktor.server.plugins.doublereceive.*
import io.ktor.server.plugins.statuspages.*
Expand Down Expand Up @@ -107,31 +107,6 @@ fun main() {
}
}

fun toLogString(subject: Any): String = when (subject) {
is TextContent -> subject.text
is OutputStreamContent -> {
val channel = ByteChannel(true)
runBlocking {
subject.writeTo(channel)
StringBuilder().apply {
while (!channel.isClosedForRead) channel.readUTF8LineTo(this)
}.toString()
}
}

else -> "???"
}

suspend fun PipelineContext<Unit, ApplicationCall>.logResponseBody(call: ApplicationCall) {
call.response.pipeline.intercept(ApplicationSendPipeline.Engine) { message ->
this@embeddedServer.log.debug("Response Body (${call.request.uri}): ${toLogString(message)}")
}
}

intercept(ApplicationCallPipeline.Call) {
logResponseBody(call)
}

install(StatusPages) {
exception<Throwable> { call, cause ->
cause.printStackTrace()
Expand Down Expand Up @@ -175,7 +150,7 @@ fun Application.test() {
routing {

get("/jwks") {
context.respond(mapOf(
call.respond(mapOf(
"keys" to listOf(key).map { it.toPublicJWK().toJSONObject() }
))
}
Expand Down
16 changes: 8 additions & 8 deletions waltid-libraries/auth/waltid-ktor-authnz/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
kotlin("jvm")
kotlin("plugin.power-assert")
kotlin("plugin.serialization")
id("io.ktor.plugin") version "2.3.12"
id("io.ktor.plugin") version "3.1.0"
id("maven-publish")

application
Expand Down Expand Up @@ -85,24 +85,24 @@ dependencies {
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm")

// Ktor server external
implementation("io.github.smiley4:ktor-swagger-ui:3.5.1")
implementation("io.github.smiley4:ktor-swagger-ui:4.1.6")

// JSON
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.2")
implementation("com.eygraber:jsonpathkt-kotlinx:3.0.2")

// Logging
implementation("io.klogging:klogging-jvm:0.7.2")
implementation("io.klogging:slf4j-klogging:0.7.2")
implementation("io.klogging:klogging-jvm:0.9.1")
implementation("io.klogging:slf4j-klogging:0.9.1")

/* --- Testing --- */
testImplementation("io.ktor:ktor-client-logging")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.9.0")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.1")

// Ktor
testImplementation("io.ktor:ktor-server-cio-jvm")
testImplementation("io.ktor:ktor-server-tests-jvm")
testImplementation("io.ktor:ktor-server-test-host")

// Kotlin
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ object MultiStepExample : AuthenticationMethod("multistep-example") {
val publicKey: String
)

override fun Route.register(authContext: PipelineContext<Unit, ApplicationCall>.() -> AuthContext) {
override fun Route.register(authContext: ApplicationCall.() -> AuthContext) {
route("multistep-example") {
get("nonce") { // Step 1
context.respond(makeNonce())
call.respond(makeNonce())
}

post<MultiStepExampleSigned>("signed", { // Step 2
Expand Down Expand Up @@ -191,7 +191,7 @@ fun Route.globalMultistepExample() {
""".trimIndent()
val authFlow = AuthFlow.fromConfig(flowConfig)

val contextFunction: PipelineContext<Unit, ApplicationCall>.() -> AuthContext = {
val contextFunction: ApplicationCall.() -> AuthContext = {
AuthContext(
tenant = call.request.host(),
sessionId = call.parameters["sessionId"],
Expand Down Expand Up @@ -225,7 +225,7 @@ fun Application.testApp() {
post<AccountIdentifier>("register-by-identifier") { identifier ->
val newAccountId = Uuid.random().toString()
KtorAuthnzManager.accountStore.addAccountIdentifierToAccount(newAccountId, identifier)
context.respond(newAccountId)
call.respond(newAccountId)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,21 @@ import id.walt.ktorauthnz.KtorAuthnzManager
import id.walt.ktorauthnz.sessions.AuthSession
import io.ktor.server.application.*
import io.ktor.server.auth.*
import io.ktor.server.routing.RoutingContext
import io.ktor.util.pipeline.*

fun PipelineContext<Unit, ApplicationCall>.getAuthToken(): String {
val token = call.principal<UserIdPrincipal>()?.name
fun ApplicationCall.getAuthToken(): String {
val token = principal<UserIdPrincipal>()?.name
check(token != null) { "No token for request principal" }

return token
}

// TODO: switch to @OptIn instead of @Deprecated
@Deprecated("Externally provided JWT token cannot resolve to authenticated session")
suspend fun PipelineContext<Unit, ApplicationCall>.getAuthenticatedSession(): AuthSession {
val token = getAuthToken()

return KtorAuthnzManager.tokenHandler.resolveTokenToSession(token)
}

suspend fun PipelineContext<Unit, ApplicationCall>.getAuthenticatedAccount(): String {
val token = getAuthToken()
@Deprecated("Externally provided JWT token cannot resolve to authenticated session")
suspend fun RoutingContext.getAuthenticatedSession(): AuthSession = KtorAuthnzManager.tokenHandler.resolveTokenToSession(call.getAuthToken())
@Deprecated("Externally provided JWT token cannot resolve to authenticated session")
suspend fun PipelineContext<Unit, ApplicationCall>.getAuthenticatedSession(): AuthSession = KtorAuthnzManager.tokenHandler.resolveTokenToSession(call.getAuthToken())

return KtorAuthnzManager.tokenHandler.getTokenAccountId(token)
}
suspend fun ApplicationCall.getAuthenticatedAccount(): String = KtorAuthnzManager.tokenHandler.getTokenAccountId(getAuthToken())
Loading

0 comments on commit 6c617fc

Please sign in to comment.