fixing auth-build konflikte
This commit is contained in:
@@ -47,7 +47,7 @@ zipkinReporter = "3.5.1"
|
||||
|
||||
# --- Authentication ---
|
||||
auth0Jwt = "4.5.0"
|
||||
keycloak = "26.4.0"
|
||||
keycloakAdminClient = "26.0.7"
|
||||
|
||||
# --- Testing ---
|
||||
junitJupiter = "5.12.2"
|
||||
@@ -55,7 +55,7 @@ junitPlatform = "1.12.2"
|
||||
mockk = "1.14.5"
|
||||
assertj = "3.27.4"
|
||||
testcontainers = "1.21.3"
|
||||
testcontainersKeycloak = "3.8.0"
|
||||
testcontainersKeycloak = "3.9.0"
|
||||
|
||||
# --- Resilience4j ---
|
||||
resilience4j = "2.3.0"
|
||||
@@ -162,7 +162,7 @@ spring-boot-starter-aop = { module = "org.springframework.boot:spring-boot-start
|
||||
|
||||
# --- Authentication ---
|
||||
auth0-java-jwt = { module = "com.auth0:java-jwt", version.ref = "auth0Jwt" }
|
||||
keycloak-admin-client = { module = "org.keycloak:keycloak-admin-client", version.ref = "keycloak" }
|
||||
keycloak-admin-client = { module = "org.keycloak:keycloak-admin-client", version.ref = "keycloakAdminClient" }
|
||||
|
||||
# --- Utilities ---
|
||||
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
|
||||
@@ -272,7 +272,8 @@ testing-jvm = [
|
||||
testcontainers = [
|
||||
"testcontainers-core",
|
||||
"testcontainers-junit-jupiter",
|
||||
"testcontainers-postgresql"
|
||||
"testcontainers-postgresql",
|
||||
"testcontainers-keycloak"
|
||||
]
|
||||
# Bündelt alle Abhängigkeiten, die ein Service für Metriken und Tracing benötigt.
|
||||
monitoring-client = [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -33,8 +33,10 @@ dependencies {
|
||||
// Spring Security für die Absicherung des Servers.
|
||||
implementation(libs.spring.boot.starter.security)
|
||||
implementation(libs.spring.boot.starter.oauth2.resource.server)
|
||||
|
||||
// Keycloak Admin Client zur Verwaltung von Benutzern und Realms.
|
||||
implementation(libs.keycloak.admin.client)
|
||||
|
||||
// API-Dokumentation mit OpenAPI/Swagger.
|
||||
implementation(libs.springdoc.openapi.starter.webmvc.ui)
|
||||
// Monitoring und Metriken für Production-Readiness.
|
||||
|
||||
+15
@@ -3,9 +3,24 @@ package at.mocode.infrastructure.auth
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.runApplication
|
||||
|
||||
/**
|
||||
* Hauptklasse für den Auth-Server.
|
||||
*
|
||||
* Dieser Service fungiert als zentraler Authentifizierungs- und Autorisierungsserver,
|
||||
* der mit Keycloak kommuniziert und JWT-Token-Management bereitstellt.
|
||||
*
|
||||
* Funktionalitäten:
|
||||
* - JWT Token Generation und Validierung
|
||||
* - Integration mit Keycloak
|
||||
* - Benutzer- und Berechtigungsverwaltung
|
||||
* - REST API für Authentifizierung
|
||||
*/
|
||||
@SpringBootApplication
|
||||
class AuthServerApplication
|
||||
|
||||
/**
|
||||
* Haupteinstiegspunkt für den Auth-Server Service
|
||||
*/
|
||||
fun main(args: Array<String>) {
|
||||
runApplication<AuthServerApplication>(*args)
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import java.time.Duration
|
||||
class KeycloakIntegrationTest {
|
||||
|
||||
companion object {
|
||||
private const val KEYCLOAK_VERSION = "25.0.2"
|
||||
private const val KEYCLOAK_VERSION = "26.4.0"
|
||||
private const val KEYCLOAK_PORT = 8080
|
||||
private const val KEYCLOAK_ADMIN_USER = "admin"
|
||||
private const val KEYCLOAK_ADMIN_PASSWORD = "admin"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
// Dieses Modul ist das API-Gateway und der einzige öffentliche Einstiegspunkt
|
||||
// für alle externen Anfragen an das Meldestelle-System.
|
||||
plugins {
|
||||
@@ -104,3 +106,7 @@ tasks.register<Test>("integrationTest") {
|
||||
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
|
||||
}
|
||||
}
|
||||
val compileKotlin: KotlinCompile by tasks
|
||||
compileKotlin.compilerOptions {
|
||||
freeCompilerArgs.set(listOf("-Xannotation-default-target=param-property"))
|
||||
}
|
||||
|
||||
+4
-4
@@ -8,8 +8,8 @@ import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity
|
||||
import org.springframework.security.config.web.server.ServerHttpSecurity
|
||||
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder
|
||||
import org.springframework.security.oauth2.jwt.NimbusReactiveJwtDecoder
|
||||
import org.springframework.security.oauth2.jwt.ReactiveJwtDecoder
|
||||
import org.springframework.security.web.server.SecurityWebFilterChain
|
||||
import org.springframework.web.cors.CorsConfiguration
|
||||
import org.springframework.web.cors.reactive.CorsConfigurationSource
|
||||
@@ -66,8 +66,8 @@ import java.time.Duration
|
||||
@EnableConfigurationProperties(GatewaySecurityProperties::class)
|
||||
class SecurityConfig(
|
||||
private val securityProperties: GatewaySecurityProperties,
|
||||
@Value("\${keycloak.issuer-uri:}") private val issuerUri: String,
|
||||
@Value("\${keycloak.jwk-set-uri:}") private val jwkSetUri: String
|
||||
@Value($$"${keycloak.issuer-uri:}") private val issuerUri: String,
|
||||
@Value($$"${keycloak.jwk-set-uri:}") private val jwkSetUri: String
|
||||
) {
|
||||
|
||||
/**
|
||||
@@ -75,7 +75,7 @@ class SecurityConfig(
|
||||
*
|
||||
* Diese Methode konfiguriert die reaktive Sicherheits-Filterkette mit:
|
||||
* - CSRF deaktiviert für zustandslosen API-Betrieb
|
||||
* - Expliziter CORS-Konfiguration für Cross-Origin-Unterstützung
|
||||
* - Explizite CORS-Konfiguration für Cross-Origin-Unterstützung
|
||||
* - Permissiver Autorisierung (Authentifizierung durch den JWT-Filter)
|
||||
*
|
||||
* Die Konfiguration bleibt kompatibel mit der bestehenden Filterarchitektur
|
||||
|
||||
Reference in New Issue
Block a user