Fix: Test-Commit für VCS-Integration (MP-8) (#15)
* MP-8 OTHER Implementiere JWT-Authentifizierungs-Filter im Gateway * Fix(ci): Update upload-artifact action to v4 * Fix(ci): Add start command for Keycloak and failure logs * Fix(ci): Remove invalid 'command' property from Keycloak service * Fix(ci): Use KC_DEV_MODE env var to start Keycloak * Fix(ci): Keycloak service was removed from GitHub Actions services and replaced with a manual docker run step that starts Keycloak with the start-dev command. * dev(ci): vereinheitliche Keycloak auf 26.4.2; aktiviere Health im CI (MP-8) * Fix(ci): Stabilize Keycloak startup in integration tests via matrix - Add `dev-file` Keycloak variant to matrix for stability fallback. - Improve wait logic and health checks for Keycloak and Postgres. - Unify Keycloak version to 26.4.2 across codebase. - Add log dumps on failure. * Fix(ci): Die betroffene Datei docs/Visionen-Ideen/Infrastruktur-Strategie_DSGVO-Konformität.md endet aktuell mit genau einer leeren Zeile (Zeile 87). Das entspricht der Regel MD047 („Files should end with a single newline character“). Damit ist deine Korrektur korrekt. * Fix(ci): Repository-wide auto-fix for Markdown files was implemented with a GitHub Actions workflow and a local helper script. EditorConfig and markdownlint ignore files were added to ensure consistent formatting. Instructions for using the auto-fix both via GitHub Actions and locally were provided. * fix(gradle): build.gradle.kts jsBrowser testTask disabled * fix(gradle): build.gradle.kts jsBrowser testTask disabled * Fix(ci): Stabilize integration tests with Keycloak matrix build (MP-8) Introduces a matrix strategy (`keycloak_db: [postgres, dev-file]`) in the integration-tests workflow to mitigate flaky Keycloak starts when using the Postgres service container. - Adds a `dev-file` Keycloak variant for stability fallback. - Improves wait logic and health checks for Keycloak/Postgres. - Unifies Keycloak version to 26.4.2 across codebase (Dockerfile, Compose, ADR, README, tests). - Adds log dumps on failure in CI. - Ensures `KC_HEALTH_ENABLED=true` is set. - Updates related documentation (README, Schlachtplan). - Includes broader Docker SSoT cleanup (versions.toml as source, script updates, env file cleanup, validator hardening). This resolves recurring CI failures related to Keycloak startup and ensures required checks for PRs (#15) are reliable, while also improving overall Docker build consistency. * feat(docs, ci): Implement YouTrack SSoT strategy with Dokka sync (MP-8) - Add Dokka multi-module Gradle configuration and KDoc style guide. - Add GitHub Actions workflow (docs-kdoc-sync.yml) and Python script (youtrack-sync-kb.py) to sync Dokka GFM output to YouTrack KB. - Extend front-matter schema (bc, doc_type) and update relevant pages/stubs. - Adapt CI scripts (validate-frontmatter, check-docs-drift, ci-docs link ignore). - Update README.md to reference YouTrack KB. * feat(docs, ci): Implement YouTrack SSoT strategy with Dokka sync (MP-8) - Add Dokka multi-module Gradle configuration and KDoc style guide. - Add GitHub Actions workflow (docs-kdoc-sync.yml) and Python script (youtrack-sync-kb.py) to sync Dokka GFM output to YouTrack KB. - Extend front-matter schema (bc, doc_type) and update relevant pages/stubs. - Adapt CI scripts (validate-frontmatter, check-docs-drift, ci-docs link ignore). - Update README.md to reference YouTrack KB. * Fix(ci): Replace OpenAPI validator with Spectral Replaces the deprecated 'char0n/swagger-editor-validate' action, which failed due to sandbox issues in GitHub Actions, with the modern '@stoplight/spectral-cli'. This ensures robust OpenAPI specification validation without requiring a headless browser environment. The 'generate-api-docs' job now depends on the successful completion of the Spectral validation. Part of resolving CI failures for PR #15 (MP-8). * Fix(ci): Specify spectral:oas ruleset for OpenAPI validation (MP-8) * Fix(ci): Remove explicit ruleset argument for Spectral validation (MP-8) * Fix(ci): Added a .spectral.yaml file to fix Spectral linting errors. Corrected markdown lint issues in two documentation files. Updated README.md with a new guidelines section to fix link validation errors. * Fix(ci): Markdownlint errors were fixed by adding required blank lines. The Guidelines Validation error was resolved by updating the README.md link. The API Documentation Generator workflow was stabilized by updating paths, tasks, and validation steps. * Fix(ci): Alle vier fehlerhaften GitHub-Action-Prüfungen wurden behoben. Fehler in der OpenAPI-Spezifikation, Probleme mit der Markdown-Linting-Analyse und Validierungsfehler bei Querverweisen wurden korrigiert. Die README.md enthält nun alle erforderlichen Links zu den Richtlinien. * Fix(ci): Markdown linting errors in docs/api/README.md were fixed by specifying languages in fenced code blocks. OpenAPI specification errors in documentation.yaml were resolved by correcting example property types to strings. Cross-reference validation errors in README.md were fixed by adding the missing link to project-standards/coding-standards.md. * Fix(ci): Duplicate heading errors in docs/api/members-api.md were fixed. Cross-reference validation errors for docker-architecture.md were resolved. All originally reported issues passed validation successfully. * Fix(ci): The markdown heading levels in docs/api/members-api.md were corrected from h5 to h4 to fix linting errors. The missing cross-reference link from technology-guides/docker/docker-development.md to docker-overview.md was added. These fixes resolved the original validation and linting errors causing the process to fail. * Fix(ci): Duplicate heading warnings in docs/api/members-api.md were resolved. Cross-reference validation for docker-development.md to docker-architecture.md was fixed. A new unrelated warning about docker-production.md was identified but not addressed. * refactor(ci,docs): Simplify CI pipeline and migrate docs to YouTrack SSoT BREAKING CHANGE: Documentation structure radically simplified - Consolidate 9 GitHub Actions workflows into 1 main pipeline (ci-main.yml) - Remove redundant workflows: ci-docs, markdownlint-autofix, guidelines-validation, api-docs - Delete documentation migrated to YouTrack: api/, BCs/, Visionen-Ideen/, reference/, now/, overview/ - Keep only ADRs, C4 diagrams, and essential dev guides in repo - Update README.md with YouTrack KB links - Create new docs/README.md as documentation gateway - Relax markdown-lint config for pragmatic developer experience Kept workflows: - ssot-guard.yml (Docker SSoT validation) - docs-kdoc-sync.yml (KDoc → YouTrack sync) - integration-tests.yml (Integration tests) - deploy-proxmox.yml (Deployment) - youtrack-sync.yml (YouTrack integration) Related: MP-DOCS-001 * refactor(ci,docs): Simplify CI pipeline and migrate docs to YouTrack SSoT BREAKING CHANGE: Documentation structure radically simplified - Consolidate 9 GitHub Actions workflows into 1 main pipeline (ci-main.yml) - Remove redundant workflows: ci-docs, markdownlint-autofix, guidelines-validation, api-docs - Delete documentation migrated to YouTrack: api/, BCs/, Visionen-Ideen/, reference/, now/, overview/ - Keep only ADRs, C4 diagrams, and essential dev guides in repo - Update README.md with YouTrack KB links - Create new docs/README.md as documentation gateway - Relax markdown-lint config for pragmatic developer experience Kept workflows: - ssot-guard.yml (Docker SSoT validation) - docs-kdoc-sync.yml (KDoc → YouTrack sync) - integration-tests.yml (Integration tests) - deploy-proxmox.yml (Deployment) - youtrack-sync.yml (YouTrack integration) Related: MP-DOCS-001 * refactor(ci,docs): README.md und einige andere Dokumentationen überarbeitet. ports-and-urls.md hinzugefügt. Related: MP-DOCS-001 * refactor(ci,docs): Die Markdownlint-Fehler in README.md und docs/README.md wurden behoben, indem die Überschriftenebenen angepasst, überflüssige Satzzeichen am Ende entfernt und die notwendigen Leerzeilen um Überschriften, Listen, Tabellen und Codeblöcke eingefügt wurden. Das problematische Leerzeichen am Ende in docs/README.md wurde ebenfalls entfernt. Die Dateien entsprechen nun den vorgegebenen Markdownlint-Regeln und sollten die CI-Validierung bestehen. Related: MP-DOCS-001 * refactor(ci,docs): Docker guideline cross-references were fixed and normalized to lowercase labels. Validation scripts confirmed zero cross-reference warnings and consistent metadata. Documentation was updated with a changelog and enhanced README navigation. Related: MP-DOCS-001 * refactor(ci,docs): Docker guideline cross-references were fixed and normalized to lowercase labels. Validation scripts confirmed zero cross-reference warnings and consistent metadata. Documentation was updated with a changelog and enhanced README navigation. Related: MP-DOCS-001 * refactor(ci,docs): Dead links in docs/architecture/adr were fixed by updating URLs to stable sources and adding an ignore pattern for a placeholder link. Specific ADR files had their broken links replaced with valid ones. The markdown-link-check GitHub Action is expected to pass with zero dead links now. Related: MP-DOCS-001 * refactor(ci,docs): Links in ADR checked Related: MP-DOCS-001 * refactor(ci,docs): Links in ADR checked Related: MP-DOCS-001 * refactor(ci,docs): Markdown Regeln ausgebessert Related: MP-DOCS-001 * refactor(ci,docs): Markdown Regeln ausgebessert Related: MP-DOCS-001 * refactor(ci,docs): Markdown Regeln ausgebessert Related: MP-DOCS-001 * Chore: Rerun CI checks with updated branch protection rules
This commit is contained in:
@@ -36,14 +36,15 @@ infrastructure/auth/
|
||||
Dieses Modul ist eine **wiederverwendbare Bibliothek** und kein eigenständiger Service. Es enthält die gesamte Logik, die andere Microservices (wie `masterdata-service`, `members-service` etc.) benötigen, um ihre Endpunkte abzusichern.
|
||||
|
||||
Aktueller Stand (09/2025):
|
||||
|
||||
- Enthält ein typensicheres Rollen- und Berechtigungsmodell: `RolleE`, `BerechtigungE` (kotlinx.serialization-annotiert für konsistente JSON-Serialisierung).
|
||||
- Definiert die Schnittstelle `AuthenticationService` mit suspend-Funktionen und Result-Typen zur Authentifizierung und Passwortänderung. Rückgabewerte sind versiegelt (sealed) und decken Success/Failure/Locked ab. Dadurch klare, explizite Fehlerfälle ohne Exceptions in Kontrollflüssen.
|
||||
- Stellt den `JwtService` bereit, der via Spring konfiguriert werden kann und in Services zur Token-Erzeugung/-Validierung genutzt wird.
|
||||
|
||||
**Hauptaufgaben:**
|
||||
* **JWT-Management:** Stellt einen `JwtService` zur Erstellung und Validierung von JSON Web Tokens bereit (Signatur, Claims, Ablaufzeiten). Neue, result-basierte APIs erleichtern das Fehler-Handling.
|
||||
* **Modell-Definition:** Definiert die **Quelle der Wahrheit** für sicherheitsrelevante Konzepte wie `RolleE` und `BerechtigungE` als typsichere Kotlin-Enums. Dies stellt sicher, dass alle Services dieselbe "Sprache" für Berechtigungen sprechen.
|
||||
* **Schnittstellen:** Bietet saubere Schnittstellen wie `AuthenticationService` an, die von der konkreten Implementierung (z.B. Keycloak) abstrahieren. Dadurch können Implementierungen im `auth-server` oder in Tests (Mocks/Fakes) ausgetauscht werden.
|
||||
- **JWT-Management:** Stellt einen `JwtService` zur Erstellung und Validierung von JSON Web Tokens bereit (Signatur, Claims, Ablaufzeiten). Neue, result-basierte APIs erleichtern das Fehler-Handling.
|
||||
- **Modell-Definition:** Definiert die **Quelle der Wahrheit** für sicherheitsrelevante Konzepte wie `RolleE` und `BerechtigungE` als typsichere Kotlin-Enums. Dies stellt sicher, dass alle Services dieselbe "Sprache" für Berechtigungen sprechen.
|
||||
- **Schnittstellen:** Bietet saubere Schnittstellen wie `AuthenticationService` an, die von der konkreten Implementierung (z.B. Keycloak) abstrahieren. Dadurch können Implementierungen im `auth-server` oder in Tests (Mocks/Fakes) ausgetauscht werden.
|
||||
|
||||
Einbindung: Jeder Microservice, der geschützte Endpunkte anbietet, bindet dieses Modul als Abhängigkeit ein.
|
||||
|
||||
@@ -52,9 +53,9 @@ Einbindung: Jeder Microservice, der geschützte Endpunkte anbietet, bindet diese
|
||||
Dies ist ein **eigenständiger Spring Boot Microservice**, der als Brücke zwischen dem Meldestelle-System und Keycloak agiert.
|
||||
|
||||
**Hauptaufgaben:**
|
||||
* **Benutzer-API:** Stellt eine REST-API zur Verfügung, um Benutzer zu verwalten (z.B. Registrierung). Diese API kommuniziert im Hintergrund über den `keycloak-admin-client` mit Keycloak.
|
||||
* **Token-Endpunkte:** Ist verantwortlich für das Ausstellen von Tokens nach einer erfolgreichen Authentifizierung.
|
||||
* **Implementierung der `AuthenticationService`-Schnittstelle:** Enthält die konkrete Logik, die gegen Keycloak prüft, ob ein Benutzername und ein Passwort korrekt sind.
|
||||
- **Benutzer-API:** Stellt eine REST-API zur Verfügung, um Benutzer zu verwalten (z.B. Registrierung). Diese API kommuniziert im Hintergrund über den `keycloak-admin-client` mit Keycloak.
|
||||
- **Token-Endpunkte:** Ist verantwortlich für das Ausstellen von Tokens nach einer erfolgreichen Authentifizierung.
|
||||
- **Implementierung der `AuthenticationService`-Schnittstelle:** Enthält die konkrete Logik, die gegen Keycloak prüft, ob ein Benutzername und ein Passwort korrekt sind.
|
||||
|
||||
**Konfiguration (AuthServerConfiguration):**
|
||||
Der Service stellt einen konfigurierbaren `JwtService` per Spring-Bean bereit. Die dazugehörigen Properties werden über `auth.jwt.*` gesetzt:
|
||||
@@ -69,6 +70,7 @@ auth:
|
||||
```
|
||||
|
||||
Kotlin-Konfiguration (vereinfacht):
|
||||
|
||||
```kotlin
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(JwtProperties::class)
|
||||
@@ -94,12 +96,12 @@ Hinweis: Standardwerte sind nur für lokale Entwicklung gedacht und müssen in P
|
||||
|
||||
## Zusammenspiel im System
|
||||
|
||||
1. Ein **Benutzer** meldet sich über eine Client-Anwendung am **`auth-server`** an.
|
||||
2. Der **`auth-server`** validiert die Anmeldedaten gegen **Keycloak**.
|
||||
3. Bei Erfolg erstellt der `auth-server` mit dem `JwtService` aus dem `auth-client` ein JWT, das die Berechtigungen des Benutzers enthält, und sendet es an den Client zurück.
|
||||
4. Der **Client** sendet eine Anfrage an einen anderen Microservice (z.B. `members-service`) und fügt das JWT als Bearer-Token in den Header ein.
|
||||
5. Der **`members-service`**, der ebenfalls den `auth-client` als Abhängigkeit hat, nutzt den `JwtService`, um das Token zu validieren und die Berechtigungen typsicher auszulesen.
|
||||
6. Das **Gateway** kann vorgelagert JWT-basierte Authentifizierung durchführen. Aktuell existiert ein `JwtAuthenticationFilter`, der über `gateway.security.jwt.enabled=true` aktiviert wird. In der vorliegenden Codebasis nutzt dieser noch eine vereinfachte Validierung; die geplante Integration ist die Nutzung des `auth-client` zur vollständigen Validierung und Claim-Extraktion.
|
||||
1. Ein **Benutzer** meldet sich über eine Client-Anwendung am **`auth-server`** an.
|
||||
2. Der **`auth-server`** validiert die Anmeldedaten gegen **Keycloak**.
|
||||
3. Bei Erfolg erstellt der `auth-server` mit dem `JwtService` aus dem `auth-client` ein JWT, das die Berechtigungen des Benutzers enthält, und sendet es an den Client zurück.
|
||||
4. Der **Client** sendet eine Anfrage an einen anderen Microservice (z.B. `members-service`) und fügt das JWT als Bearer-Token in den Header ein.
|
||||
5. Der **`members-service`**, der ebenfalls den `auth-client` als Abhängigkeit hat, nutzt den `JwtService`, um das Token zu validieren und die Berechtigungen typsicher auszulesen.
|
||||
6. Das **Gateway** kann vorgelagert JWT-basierte Authentifizierung durchführen. Aktuell existiert ein `JwtAuthenticationFilter`, der über `gateway.security.jwt.enabled=true` aktiviert wird. In der vorliegenden Codebasis nutzt dieser noch eine vereinfachte Validierung; die geplante Integration ist die Nutzung des `auth-client` zur vollständigen Validierung und Claim-Extraktion.
|
||||
|
||||
Diese Architektur entkoppelt die Fach-Services von der Komplexität der Identitätsverwaltung und schafft eine robuste, zentrale Sicherheitsinfrastruktur.
|
||||
|
||||
@@ -108,6 +110,7 @@ Diese Architektur entkoppelt die Fach-Services von der Komplexität der Identit
|
||||
### Technische Verbesserungen
|
||||
|
||||
**Dependencies Updates:**
|
||||
|
||||
- Spring Boot: 3.2.5 → 3.3.2 (Security-Updates und Performance-Verbesserungen)
|
||||
- Spring Cloud: 2023.0.1 → 2023.0.3 (Bug-Fixes)
|
||||
- Spring Dependency Management: 1.1.5 → 1.1.6 (Kompatibilität)
|
||||
@@ -115,6 +118,7 @@ Diese Architektur entkoppelt die Fach-Services von der Komplexität der Identit
|
||||
- Keycloak: 23.0.0 → 25.0.2 (Wichtige Sicherheitsupdates)
|
||||
|
||||
**Code Modernisierung:**
|
||||
|
||||
- **JWT Service**: Implementierung von Result-basierten APIs für besseres Error-Handling
|
||||
- **Structured Logging**: Integration von KotlinLogging für strukturierte Log-Ausgabe
|
||||
- **Exception Handling**: Spezifische JWT-Exception-Behandlung statt Catch-All-Blöcke
|
||||
@@ -122,12 +126,14 @@ Diese Architektur entkoppelt die Fach-Services von der Komplexität der Identit
|
||||
- **Backward Compatibility**: Deprecated Legacy-Methoden für sanfte Migration
|
||||
|
||||
**Test-Verbesserungen:**
|
||||
|
||||
- Entfernung von `Thread.sleep()` für zuverlässigere Tests
|
||||
- Bessere Expired-Token-Tests mit eindeutigen Zeitstempel-Differenzen
|
||||
|
||||
### Token Claims und Struktur
|
||||
|
||||
Empfohlene Claims im JWT (Beispiel):
|
||||
|
||||
- sub: Benutzer-ID (UUID)
|
||||
- pid: Personen-ID (UUID)
|
||||
- preferred_username: Loginname (derzeit intern als Claim "username" umgesetzt)
|
||||
@@ -143,6 +149,7 @@ Diese Claims werden vom `auth-client` gelesen und in typsichere Modelle abgebild
|
||||
### API-Änderungen
|
||||
|
||||
**Neue Result-basierte APIs:**
|
||||
|
||||
```kotlin
|
||||
// Neu: Result-basierte APIs mit strukturiertem Error-Handling
|
||||
fun validateToken(token: String): Result<Boolean>
|
||||
@@ -160,6 +167,7 @@ fun getPermissions(token: String): List<BerechtigungE>
|
||||
### Auth-Client Modernisierung
|
||||
|
||||
**Plugin-Erweiterungen:**
|
||||
|
||||
```kotlin
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.jvm)
|
||||
@@ -171,12 +179,14 @@ plugins {
|
||||
```
|
||||
|
||||
**Neue Dependencies:**
|
||||
|
||||
- **Kotlin Serialization**: Konsistente JSON-Verarbeitung mit anderen Modulen
|
||||
- **Type Safety**: Kompiletime-Validierung von JSON-Strukturen
|
||||
|
||||
### Auth-Server Production-Readiness
|
||||
|
||||
**Production-Ready Dependencies:**
|
||||
|
||||
```kotlin
|
||||
// API-Dokumentation mit OpenAPI/Swagger
|
||||
implementation(libs.springdoc.openapi.starter.webmvc.ui)
|
||||
@@ -189,6 +199,7 @@ implementation(libs.kotlinx.serialization.json)
|
||||
```
|
||||
|
||||
**Neue Endpoints:**
|
||||
|
||||
- `/actuator/health` - Health Check
|
||||
- `/actuator/metrics` - Prometheus Metrics
|
||||
- `/actuator/info` - Application Info
|
||||
@@ -196,6 +207,7 @@ implementation(libs.kotlinx.serialization.json)
|
||||
- `/v3/api-docs` - OpenAPI JSON Schema
|
||||
|
||||
**Monitoring Stack:**
|
||||
|
||||
- **Prometheus Metrics**: Via `micrometer-prometheus`
|
||||
- **Distributed Tracing**: Via `micrometer-tracing-bridge-brave`
|
||||
- **Zipkin Integration**: Für Request-Tracing
|
||||
@@ -208,29 +220,37 @@ Das Auth-Modul wurde von **kritisch untergetestet** auf **umfassend getestet** t
|
||||
### Test-Statistiken
|
||||
|
||||
**Vor der Implementierung:**
|
||||
|
||||
- JwtService: 5 Tests (Basis-Funktionalität)
|
||||
- Andere Module: 0 Tests ❌
|
||||
|
||||
**Nach der Implementierung:**
|
||||
|
||||
- **Gesamt: 80+ Tests** implementiert
|
||||
- **Erfolgsquote: 95%+** (nur umgebungsabhängige Performance-Tests variieren)
|
||||
|
||||
### Implementierte Test-Suiten
|
||||
|
||||
#### 1. JwtServiceExtendedTest ✅
|
||||
|
||||
**19 Tests** - Erweiterte JWT-Tests mit Result-APIs
|
||||
|
||||
- Result API Tests mit strukturiertem Error-Handling
|
||||
- Security Edge Cases und Token-Tampering
|
||||
- Legacy Compatibility für deprecated Methoden
|
||||
|
||||
#### 2. AuthenticationServiceTest ✅
|
||||
|
||||
**15 Tests** - Mock-Tests für Authentication Interface
|
||||
|
||||
- Authentication Scenarios (Success, Failure, Locked)
|
||||
- Password Management und Validation
|
||||
- Sealed Class Pattern Testing
|
||||
|
||||
#### 3. SecurityTest ✅
|
||||
|
||||
**15 Tests** - Sicherheitstests für JWT-Vulnerabilities
|
||||
|
||||
- Signature Tampering Protection
|
||||
- Timing Attack Resistance
|
||||
- Algorithm Confusion Prevention
|
||||
@@ -238,25 +258,32 @@ Das Auth-Modul wurde von **kritisch untergetestet** auf **umfassend getestet** t
|
||||
- Memory Safety Tests
|
||||
|
||||
#### 4. AuthPerformanceTest ✅
|
||||
|
||||
**13 Tests** - Performance-Tests (11+ bestanden)
|
||||
|
||||
- JWT Validation: < 20ms für komplexe Szenarien
|
||||
- Token Generation: < 5ms pro Token
|
||||
- Concurrent Throughput: > 10,000 validations/sec
|
||||
- Memory Stability: < 50MB bei 10,000 Operationen
|
||||
|
||||
#### 5. ResultApiTest ✅
|
||||
|
||||
**13 Tests** - Result-basierte API-Tests
|
||||
|
||||
- Result Success/Failure Cases
|
||||
- Functional Programming Patterns
|
||||
- Kotlin Standard Library Integration
|
||||
- Error Handling Consistency
|
||||
|
||||
#### 6. Integration Tests ✅
|
||||
|
||||
**29+ Tests** - Minimal Integration Tests
|
||||
|
||||
- AuthServerIntegrationTest: 15 Tests (minimale Spring-Konfiguration)
|
||||
- KeycloakIntegrationTest: 14 Tests (Container-only Testing, Docker-abhängig)
|
||||
|
||||
**Integration Test Details:**
|
||||
|
||||
- KeycloakIntegrationTest nutzt Testcontainers mit Keycloak 25.0.2
|
||||
- Tests sind mit @EnabledIf Docker-conditional ausgestattet
|
||||
- Automatische Keycloak-Container-Erkennung und -Konfiguration
|
||||
@@ -265,6 +292,7 @@ Das Auth-Modul wurde von **kritisch untergetestet** auf **umfassend getestet** t
|
||||
### Performance-Validierung
|
||||
|
||||
**Erfüllte Benchmarks:**
|
||||
|
||||
- ✅ JWT Validation: Durchschnitt < 1ms
|
||||
- ✅ Token Generation: Durchschnitt < 2ms
|
||||
- ✅ Concurrent Throughput: > 10,000 ops/sec
|
||||
@@ -272,6 +300,7 @@ Das Auth-Modul wurde von **kritisch untergetestet** auf **umfassend getestet** t
|
||||
- ✅ Consistent Performance: < 20% Degradation über Zeit
|
||||
|
||||
**Debug-Ausgaben:**
|
||||
|
||||
```
|
||||
[DEBUG_LOG] Token generation: ~1.5ms average
|
||||
[DEBUG_LOG] Token validation: ~0.8ms average
|
||||
@@ -281,12 +310,14 @@ Das Auth-Modul wurde von **kritisch untergetestet** auf **umfassend getestet** t
|
||||
### Sicherheitsvalidierung
|
||||
|
||||
**CVE-Schutz implementiert:**
|
||||
|
||||
- JWT Algorithm Confusion (CVE-2018-0114)
|
||||
- JWT Signature Bypass Versuche
|
||||
- DoS via Long Tokens Prevention
|
||||
- Information Disclosure Prevention
|
||||
|
||||
**Security Features getestet:**
|
||||
|
||||
- ✅ Token Tampering Protection (validiert in isolierten Tests 15.08.2025)
|
||||
- ✅ Timing Attack Resistance
|
||||
- ✅ Concurrent Access Safety
|
||||
@@ -294,6 +325,7 @@ Das Auth-Modul wurde von **kritisch untergetestet** auf **umfassend getestet** t
|
||||
- ✅ Injection Attack Prevention
|
||||
|
||||
**Aktuelle Sicherheitsvalidierung (15. August 2025):**
|
||||
|
||||
- Alle 15 SecurityTest-Tests erfolgreich bestanden
|
||||
- JWT Signature Tampering Protection funktioniert korrekt
|
||||
- Keine Sicherheitslücken in der Token-Validierung festgestellt
|
||||
@@ -302,6 +334,7 @@ Das Auth-Modul wurde von **kritisch untergetestet** auf **umfassend getestet** t
|
||||
## Dependencies-Übersicht
|
||||
|
||||
### Auth-Client Dependencies
|
||||
|
||||
```kotlin;
|
||||
├── platform-bom (Version Management)
|
||||
├── platform-dependencies (Common Dependencies)
|
||||
@@ -314,6 +347,7 @@ Das Auth-Modul wurde von **kritisch untergetestet** auf **umfassend getestet** t
|
||||
```
|
||||
|
||||
### Auth-Server Dependencies
|
||||
|
||||
```kotlin;
|
||||
├── platform-bom (Version Management)
|
||||
├── platform-dependencies (Common Dependencies)
|
||||
@@ -338,6 +372,7 @@ Diese README wurde am 03.09.2025 aktualisiert und spiegelt den aktuellen Stand d
|
||||
## Production-Readiness Status
|
||||
|
||||
### ✅ Production-Ready Bereiche
|
||||
|
||||
- **JWT Service**: Vollständig getestet (40+ Tests)
|
||||
- **Result APIs**: Comprehensive Abdeckung (13 Tests)
|
||||
- **Security**: Alle kritischen Vulnerabilities getestet (15 Tests)
|
||||
@@ -347,24 +382,28 @@ Diese README wurde am 03.09.2025 aktualisiert und spiegelt den aktuellen Stand d
|
||||
- **API Documentation**: Automatische OpenAPI/Swagger-Docs
|
||||
|
||||
### ⚠️ Bereiche mit Notizen
|
||||
|
||||
- **Integration Tests**: Minimaler Ansatz implementiert (funktional)
|
||||
- **Performance Tests**: 2 Tests umgebungsabhängig (nicht kritisch)
|
||||
|
||||
## Qualitätsmerkmale
|
||||
|
||||
### Code Quality
|
||||
|
||||
- **Comprehensive Test Coverage**: Alle kritischen Pfade getestet
|
||||
- **Security-First Approach**: Sicherheit als Hauptfokus
|
||||
- **Modern Kotlin Features**: data object, Result APIs, strukturiertes Logging
|
||||
- **Backward Compatibility**: Sanfte Migration mit deprecated Methoden
|
||||
|
||||
### Maintainability
|
||||
|
||||
- **Strukturierte Test-Organisation**: Klare Kategorisierung
|
||||
- **Self-Documenting Code**: Aussagekräftige Namen und Kommentare
|
||||
- **Performance Baselines**: Monitoring-freundliche Metriken
|
||||
- **Zentrale Versionsverwaltung**: Via libs.versions.toml
|
||||
|
||||
### Development Experience
|
||||
|
||||
- **API Documentation**: Automatische Swagger/OpenAPI-Docs
|
||||
- **Type-Safe Configuration**: Plugin-Aliases und strukturierte Properties
|
||||
- **Debugging Support**: Strukturierte Logs mit Debug-Ausgaben
|
||||
|
||||
+10
-6
@@ -29,7 +29,7 @@ import java.time.Duration
|
||||
class KeycloakIntegrationTest {
|
||||
|
||||
companion object {
|
||||
private const val KEYCLOAK_VERSION = "26.4.0"
|
||||
private const val KEYCLOAK_VERSION = "26.4.2"
|
||||
private const val KEYCLOAK_PORT = 8080
|
||||
private const val KEYCLOAK_ADMIN_USER = "admin"
|
||||
private const val KEYCLOAK_ADMIN_PASSWORD = "admin"
|
||||
@@ -41,8 +41,8 @@ class KeycloakIntegrationTest {
|
||||
@JvmStatic
|
||||
val keycloakContainer: GenericContainer<*> = GenericContainer("quay.io/keycloak/keycloak:$KEYCLOAK_VERSION")
|
||||
.withExposedPorts(KEYCLOAK_PORT)
|
||||
.withEnv("KEYCLOAK_ADMIN", KEYCLOAK_ADMIN_USER)
|
||||
.withEnv("KEYCLOAK_ADMIN_PASSWORD", KEYCLOAK_ADMIN_PASSWORD)
|
||||
.withEnv("KC_BOOTSTRAP_ADMIN_USERNAME", KEYCLOAK_ADMIN_USER)
|
||||
.withEnv("KC_BOOTSTRAP_ADMIN_PASSWORD", KEYCLOAK_ADMIN_PASSWORD)
|
||||
.withCommand("start-dev")
|
||||
.waitingFor(
|
||||
Wait.forHttp("/admin/master/console/")
|
||||
@@ -197,15 +197,19 @@ class KeycloakIntegrationTest {
|
||||
// Verify container environment
|
||||
val envVars = keycloakContainer.envMap
|
||||
|
||||
assert(envVars["KEYCLOAK_ADMIN"] == KEYCLOAK_ADMIN_USER) {
|
||||
// Support new KC_BOOTSTRAP_* variables (Keycloak 26+) with fallback to legacy KEYCLOAK_* names
|
||||
val adminUser = envVars["KC_BOOTSTRAP_ADMIN_USERNAME"] ?: envVars["KEYCLOAK_ADMIN"]
|
||||
val adminPass = envVars["KC_BOOTSTRAP_ADMIN_PASSWORD"] ?: envVars["KEYCLOAK_ADMIN_PASSWORD"]
|
||||
|
||||
assert(adminUser == KEYCLOAK_ADMIN_USER) {
|
||||
"Admin user should be configured correctly"
|
||||
}
|
||||
assert(envVars["KEYCLOAK_ADMIN_PASSWORD"] == KEYCLOAK_ADMIN_PASSWORD) {
|
||||
assert(adminPass == KEYCLOAK_ADMIN_PASSWORD) {
|
||||
"Admin password should be configured correctly"
|
||||
}
|
||||
|
||||
println("[DEBUG_LOG] Environment variables validated")
|
||||
println("[DEBUG_LOG] Admin user: ${envVars["KEYCLOAK_ADMIN"]}")
|
||||
println("[DEBUG_LOG] Admin user: $adminUser")
|
||||
println("[DEBUG_LOG] Environment count: ${envVars.size}")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user