Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OIDF - 5 #17

Merged
merged 30 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
da63278
feat: Added mapper for JWT
robertmathew Jul 15, 2024
90412df
Merge branch 'refs/heads/develop' into feature/OIDF-5-entity-statemen…
robertmathew Jul 19, 2024
efa2436
feat: Created the client to fetch entity statements
Jul 21, 2024
205cadb
feat: Added OpenAPI maven local and added mapper for entity statement
robertmathew Jul 22, 2024
c5d4ca5
Merge branch 'refs/heads/develop' into feature/OIDF-5-entity-statemen…
robertmathew Jul 22, 2024
de2f394
chores: changed from implementation to api
robertmathew Jul 22, 2024
79c3c26
Merge branch 'develop' of github.com:/Sphereon-Opensource/OpenID-Fede…
Jul 23, 2024
ac2a0dc
chores: code cleanup
robertmathew Jul 23, 2024
92d1cfa
refactor: Made openid a KMM library.
Jul 23, 2024
7590c05
fix: Fixed ktor-client-cio issue
Jul 23, 2024
3e8e7c4
fix: Changed the models jvm target to 11
Jul 23, 2024
6dcd541
bugfix: Fixed OpenAPI model import issue
robertmathew Jul 24, 2024
c5cb2c0
fix: Fixed serialization issue and Open Api Generator bug
Jul 24, 2024
a3fef17
feat: Added mapping for trust chain and categorize entity statement
robertmathew Jul 25, 2024
78ce211
refactor: Refactored the unit tests
Jul 25, 2024
91f6da8
chore: Added nexus configuration
Jul 25, 2024
89685dc
refactor: Updated nexus urls
Jul 25, 2024
938b968
chores: moved decode code
robertmathew Jul 26, 2024
466c0de
chore: Added Nexus repositories to the openid-federation-common module
Jul 26, 2024
ea4a72c
Merge remote-tracking branch 'origin/feature/OIDF-7' into feature/OIDF-7
Jul 26, 2024
20cbdf8
chores: PR feedback changes
robertmathew Jul 26, 2024
f483622
refactor: Updated nexus urls and added artifacts to be published to N…
Jul 26, 2024
8ce68f9
refactor: Extended build task with the publish task
Jul 26, 2024
4e23e8c
refactor: Removed the publish task from gradle build task
Jul 26, 2024
2b33518
Merge branch 'refs/heads/feature/OIDF-5-entity-statement-mapper' into…
Jul 26, 2024
3801385
chore: Added content negotiation and content-type entity-statement+jwt
Jul 26, 2024
c82ec03
fix: enabled logger and updated GET call
robertmathew Jul 29, 2024
889eef4
Revert "fix: enabled logger and updated GET call"
robertmathew Jul 29, 2024
80b008e
chores: PR changes
robertmathew Jul 29, 2024
6503586
fix: PR changes
robertmathew Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 154 additions & 52 deletions modules/openapi/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
kotlin("jvm") version "2.0.0"
kotlin("multiplatform") version "2.0.0"
kotlin("plugin.serialization") version "2.0.0"
id("org.openapi.generator") version "7.7.0"
id("maven-publish")
}
Expand All @@ -17,66 +22,163 @@ repositories {
mavenCentral()
}

dependencies {
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.0")
}

openApiGenerate {
val openApiPackage: String by project
generatorName.set("kotlin")
packageName.set("com.sphereon.oid.fed.openapi")
apiPackage.set("$openApiPackage.api")
modelPackage.set("$openApiPackage.models")
inputSpec.set("$projectDir/src/main/kotlin/com/sphereon/oid/fed/openapi/openapi.yaml")
library.set("multiplatform")
outputDir.set("$projectDir/build/generated")
configOptions.set(
mapOf(
"dateLibrary" to "string"
)
)

if (isModelsOnlyProfile) {
globalProperties.set(
configOptions.get().plus(
mapOf(
"models" to ""
)
kotlin {
tasks {
// Temporary fix for this issue: https://github.com/OpenAPITools/openapi-generator/issues/17658
register<Copy>("fixOpenApiGeneratorIssue") {
from(
"$projectDir/build/generated/src/commonMain/kotlin/com/sphereon/oid/fed/openapi"
)
)
into(
"$projectDir/build/copy/src/commonMain/kotlin/com/sphereon/oid/fed/openapi"
)
filter { line: String ->
line.replace(
"kotlin.collections.Map<kotlin.String, kotlin.Any>",
"kotlinx.serialization.json.JsonObject")
}
}

withType<KotlinCompileCommon> {
dependsOn("fixOpenApiGeneratorIssue")
}
named("sourcesJar") {
dependsOn("fixOpenApiGeneratorIssue")
}
}
}
jvm {
tasks {
openApiGenerate {
val openApiPackage: String by project
generatorName.set("kotlin")
packageName.set("com.sphereon.oid.fed.openapi")
apiPackage.set("$openApiPackage.api")
modelPackage.set("$openApiPackage.models")
inputSpec.set("$projectDir/src/commonMain/kotlin/com/sphereon/oid/fed/openapi/openapi.yaml")
library.set("multiplatform")
outputDir.set("$projectDir/build/generated")
configOptions.set(
mapOf(
"dateLibrary" to "string"
)
)

if (isModelsOnlyProfile) {
globalProperties.set(
configOptions.get().plus(
mapOf(
"models" to ""
)
)
)
}
}

publishing {
publications {
create<MavenPublication>("mavenKotlin") {
from(components["kotlin"])
named<Copy>("fixOpenApiGeneratorIssue") {
dependsOn("openApiGenerate")
}

named<KotlinJvmCompile>("compileKotlinJvm") {
dependsOn("fixOpenApiGeneratorIssue")
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}

named("jvmSourcesJar") {
dependsOn("fixOpenApiGeneratorIssue")
}

named<Jar>("jvmJar") {
dependsOn("fixOpenApiGeneratorIssue")
archiveBaseName.set("openapi")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from(configurations.kotlinCompilerClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
from("$projectDir/build/classes/kotlin/jvm/main")
}
}
}
}

tasks.compileKotlin {
dependsOn(tasks.openApiGenerate)
}
js {
tasks {
named("compileKotlinJs") {
dependsOn("fixOpenApiGeneratorIssue")
}
named("jsSourcesJar") {
dependsOn("fixOpenApiGeneratorIssue")
}
}
nodejs()
}

iosX64 {
tasks {
named("compileKotlinIosX64") {
dependsOn("fixOpenApiGeneratorIssue")
}
named("iosX64SourcesJar") {
dependsOn("fixOpenApiGeneratorIssue")
}
}
}
iosArm64 {
tasks {
named("compileKotlinIosArm64") {
dependsOn("fixOpenApiGeneratorIssue")
}
named("iosArm64SourcesJar") {
dependsOn("fixOpenApiGeneratorIssue")
}
}
}
iosSimulatorArm64 {
tasks {
named("compileKotlinIosSimulatorArm64") {
dependsOn("fixOpenApiGeneratorIssue")
}
named("iosSimulatorArm64SourcesJar") {
dependsOn("fixOpenApiGeneratorIssue")
}
}
}

tasks.jar {
dependsOn(tasks.compileKotlin)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveBaseName.set(project.name)
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
from("$projectDir/build/classes/kotlin/main")
sourceSets {
val commonMain by getting {
kotlin.srcDir("build/copy/src/commonMain/kotlin")
dependencies {
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0")
}
}
}
}

kotlin {
sourceSets.main {
kotlin.srcDirs(
"$projectDir/build/generated/src/commonMain/kotlin"
)
publishing {
publications {
create<MavenPublication>("mavenKotlin") {
artifacts {
from(components["kotlin"])
artifact(tasks["jsJar"]) {
classifier = "js"
}
artifact(tasks["allMetadataJar"]) {
classifier = "metadata"
}
}
}
}
repositories {
maven {
name = "sphereon-opensource-snapshots"
val snapshotsUrl = "https://nexus.sphereon.com/repository/sphereon-opensource-snapshots/"
val releasesUrl = "https://nexus.sphereon.com/repository/sphereon-opensource-releases/"
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsUrl else releasesUrl)
credentials {
username = System.getenv("NEXUS_USERNAME")
password = System.getenv("NEXUS_PASSWORD")
}
}
}
jvmToolchain(21)
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,37 @@ components:
items:
$ref: '#/components/schemas/JWK'

JWTHeader:
type: object
x-tags:
- federation
properties:
alg:
type: string
description: The algorithm used to sign the JWT (e.g., RS256)
kid:
type: string
description: The unique identifier for the key used to sign the JWT
typ:
type: string
description: The type of token (optional, e.g., "entity-statement+jwt")
nullable: true
trust_chain:
type: array
description: An optional list of trust chain certificates or keys
items:
type: string
nullable: true

JWTSignature:
type: object
x-tags:
- federation
properties:
value:
type: string
description: The encoded JWT signature value.

EntityStatement:
type: object
x-tags:
Expand Down
73 changes: 47 additions & 26 deletions modules/openid-federation-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,21 @@ kotlin {
}
}

iosX64()
iosArm64()
iosSimulatorArm64()
// iosX64()
sanderPostma marked this conversation as resolved.
Show resolved Hide resolved
// iosArm64()
// iosSimulatorArm64()

jvm()

sourceSets {
val commonMain by getting {
dependencies {
implementation("com.sphereon.oid.fed:openapi:0.1.0-SNAPSHOT")
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-logging:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-client-auth:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.0")
implementation(libs.kermit.logging)
Expand All @@ -59,11 +64,13 @@ kotlin {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation("io.ktor:ktor-client-mock:$ktorVersion")
}
}
val jvmMain by getting {
dependencies {
implementation("io.ktor:ktor-client-core-jvm:$ktorVersion")
runtimeOnly("io.ktor:ktor-client-cio-jvm:$ktorVersion")
}
}
val jvmTest by getting {
Expand All @@ -75,6 +82,7 @@ kotlin {
val androidMain by getting {
dependencies {
implementation("io.ktor:ktor-client-core-jvm:$ktorVersion")
implementation("io.ktor:ktor-client-cio-jvm:$ktorVersion")
}
}
val androidUnitTest by getting {
Expand All @@ -83,32 +91,45 @@ kotlin {
}
}

val iosMain by creating {
dependsOn(commonMain)
dependencies {
implementation("io.ktor:ktor-client-ios:$ktorVersion")
}
}
val iosX64Main by getting {
dependsOn(iosMain)
}
val iosArm64Main by getting {
dependsOn(iosMain)
}
val iosSimulatorArm64Main by getting {
dependsOn(iosMain)
}

val iosTest by creating {
dependsOn(commonTest)
dependencies {
implementation(kotlin("test"))
}
}
// val iosMain by creating {
// dependsOn(commonMain)
// dependencies {
// implementation("io.ktor:ktor-client-core-ios:$ktorVersion")
// }
// }
// val iosX64Main by getting {
// dependsOn(iosMain)
// dependencies {
// implementation("io.ktor:ktor-client-core-iosx64:$ktorVersion")
// implementation("io.ktor:ktor-client-cio-iosx64:$ktorVersion")
// }
// }
// val iosArm64Main by getting {
// dependsOn(iosMain)
// dependencies {
// implementation("io.ktor:ktor-client-core-iosarm64:$ktorVersion")
// implementation("io.ktor:ktor-client-cio-iosarm64:$ktorVersion")
// }
// }
// val iosSimulatorArm64Main by getting {
// dependsOn(iosMain)
// dependencies {
// implementation("io.ktor:ktor-client-core-iossimulatorarm64:$ktorVersion")
// implementation("io.ktor:ktor-client-cio-iossimulatorarm64:$ktorVersion")
// }
// }

// val iosTest by creating {
// dependsOn(commonTest)
// dependencies {
// implementation(kotlin("test"))
// }
// }

val jsMain by getting {
dependencies {
implementation("io.ktor:ktor-client-js:$ktorVersion")
runtimeOnly("io.ktor:ktor-client-core-js:$ktorVersion")
runtimeOnly("io.ktor:ktor-client-js:$ktorVersion")
}
}

Expand Down
Loading
Loading