Skip to content

Commit

Permalink
Feature/oidf 65 2 (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmelati authored Nov 13, 2024
1 parent eebb274 commit c303a90
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 15 deletions.
7 changes: 5 additions & 2 deletions .docker/prod-deployment/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash

source ./version-config.sh
if ! source ./version-config.sh; then
echo "Error: Failed to source version-config.sh"
exit 1
fi

docker build -t ${FED_IMAGE}:${FED_VERSION} -f ../federation-server/Dockerfile ../../
docker build -t ${ADMIN_IMAGE}:${ADMIN_VERSION} -f ../admin-server/Dockerfile ../../
docker build -t ${ADMIN_IMAGE}:${FED_VERSION} -f ../admin-server/Dockerfile ../../
23 changes: 16 additions & 7 deletions .docker/prod-deployment/version-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,31 @@
# Function to extract version from gradle file
get_version() {
local gradle_file=$1
if [ ! -f "$gradle_file" ]; then
echo "Error: Gradle file not found: $gradle_file" >&2
exit 1
fi

local version=$(grep -m 1 "version = " "$gradle_file" | cut -d'"' -f2)
if [ -z "$version" ]; then
echo "Could not find version in $gradle_file"
echo "Error: Could not find version in $gradle_file" >&2
exit 1
fi
echo "$version"
}

# Base paths
MODULES_PATH="../../modules"
MODULES_PATH="../../"
REGISTRY="sphereonregistry.azurecr.io"

# Get versions
FED_VERSION=$(get_version "${MODULES_PATH}/federation-server/build.gradle.kts")
ADMIN_VERSION=$(get_version "${MODULES_PATH}/admin-server/build.gradle.kts")
# Get versions with error handling
FED_VERSION=$(get_version "${MODULES_PATH}/build.gradle.kts") || exit 1

# Image names
FED_IMAGE="federation-server"
ADMIN_IMAGE="federation-admin-server"
FED_IMAGE="${REGISTRY}/federation-server"
ADMIN_IMAGE="${REGISTRY}/federation-admin-server"

# Export variables
export FED_VERSION
export FED_IMAGE
export ADMIN_IMAGE
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ androidx-test-junit = "1.1.5"
compose-plugin = "1.6.10"
junit = "4.13.2"
kotlin = "2.0.0"
ktor = "2.3.11"
ktor = "2.3.12"
kotlinxSerialization = "1.7.1"
kotlinxCoroutines = "1.8.0"
springboot = "3.3.1"
Expand Down Expand Up @@ -84,4 +84,4 @@ kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
springboot = { id = "org.springframework.boot", version.ref = "springboot" }
springDependencyManagement = { id = "io.spring.dependency-management", version.ref = "springDependencyManagement" }
kotlinPluginSpring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
kotlinPluginSpring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
6 changes: 6 additions & 0 deletions modules/logger/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@ kotlin {
implementation(libs.kermit.logging)
}
}

val jsMain by getting {
dependencies {
implementation(libs.kermit.logging)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ fun decodeJWTComponents(jwtToken: String): JWT {
throw InvalidJwtException("Invalid JWT format: Expected 3 parts, found ${parts.size}")
}

val headerJson = Base64.decode(parts[0]).decodeToString()
val payloadJson = Base64.decode(parts[1]).decodeToString()
val headerJson = Base64.UrlSafe.decode(parts[0]).decodeToString()
val payloadJson = Base64.UrlSafe.decode(parts[1]).decodeToString()

return try {
JWT(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class TrustChain
val chain: MutableList<String> = arrayListOf()
return try {
buildTrustChainRecursive(entityIdentifier, trustAnchors, chain, cache, 0, maxDepth)
} catch (_: Exception) {
} catch (e: Exception) {
TrustChainConst.LOG.error("buildTrustChainRecursive failed", e)
// Log error
null
}
Expand Down Expand Up @@ -198,7 +199,8 @@ class TrustChain
if (result != null) return result
chain.removeLast()
}
} catch (_: Exception) {
} catch (e: Exception) { // TODO distinguish between remote HTTP errors and internal errors
TrustChainConst.LOG.error("no trust", e)
return null
}

Expand Down

0 comments on commit c303a90

Please sign in to comment.