Kite2Server is a Spring Boot (Java) backend project featuring REST APIs for data management and GPT integration.
Quick Overview
- Java: 17
- Spring Boot: 3.x (Parent in
pom.xml3.1.0) - Main Class:
com.hhn.kite2server.Kite2ServerApplication - Build Tool: Maven (uses
./mvnw/mvnw.cmdon Windows)
Table of Contents
- Prerequisites
- Build & Start
- Configuration
- Key Modules / Controllers
- Troubleshooting
- Development & Contribution
- Tests
- License
- JDK 17 installed and added to PATH
- Maven (or the provided wrapper script mvnw / mvnw.cmd)
- PostgreSQL (or a configured database)
On Windows (PowerShell):
# Build
.\mvnw.cmd clean package
# Starten (erzeugte JAR im Ordner target, finalName = Kite2Server)
java -jar .\target\Kite2Server.jar
# Alternativ direkt mit dem Maven Spring Boot Plugin (zum Entwickeln)
.\mvnw.cmd spring-boot:runOn Unix/macOS:
./mvnw clean package
java -jar ./target/Kite2Server.jarRunning Tests:
.\mvnw.cmd testThe central configuration is located in src/main/resources/application.yml. Key settings include:
server.port: Default is 8080spring.datasource.*: JDBC URL, username, and password (current values are examples — must be updated)openai.api.key/ Environment Variables: The project utilizesspring-dotenv. Sensitive keys should be stored in a.envfile or set as environment variables. Essential variables:OPENAI_API_KEY(API key for GPT)OPENAI_MODEL(e.g., gpt-4o)API_USERNAME/API_PASSWORD(if applicable)
- SSL Keystore:
src/main/resources/keystore/keystore.p12(optional).
Important: The example passwords in the repository are placeholders. Never commit sensitive data to the repository.
The project is structured into packages under com.hhn.kite2server. Important sub-packages and controllers include:
data:DataController,DataService,DataRepositorygpt:GptController,GptService,GptConfig
The main entry point is com.hhn.kite2server.Kite2ServerApplication.
The project implements a multi-layered security approach to protect API endpoints:
- All requests are validated using HMAC-SHA256 signatures
- The validator checks:
- Timestamp Header: Ensures the request is not older than 5 minutes (MAX_TIMESTAMP_AGE_SECONDS = 300)
- Signature Header: Validates the HMAC-SHA256 signature calculated from the timestamp and secret key
- Secret Key: Configured via
security.kite.hmac-secretproperty
- Validation is performed by
HmacRequestValidatorcomponent
- An additional passphrase ("shared secret") is used to prevent unauthorized access to AI features
- The passphrase is configured via
security.kite.passphraseproperty - Validated by
AuthServicethrough direct comparison - Used to control access to GPT/AI endpoints
- After successful authentication, clients receive a temporary session token
- Tokens are created via
POST /api/auth/sessionendpoint - Token validity: 10 minutes (600 seconds)
- Tokens are stored in a
ConcurrentHashMapand automatically cleaned up upon expiration - Managed by
TempTokenService
Add the following to your application.yml:
security:
kite:
hmac-secret: "your-secret-key-here"
passphrase: "your-passphrase-here"- Actuator: Enabled (exposed endpoints are configurable in
application.yml) - Access Logs: Configured in
application.ymlvia Tomcat accesslog.
- Database Connection Failed: Verify
spring.datasource.url, username, password, and ensure PostgreSQL is reachable. - TLS/SSL: To start with SSL, set
server.ssl.enabled: true and configurekey-store/key-store-password.
- Branch Workflow: Use feature branches and submit Pull Requests (PRs) against
main. - Code Format: The project follows standard Java formatting and uses Lombok in several parts of the code.
- Security: Do not commit secrets — use
.envfiles or a CI secret store instead.
- Unit and integration tests can be executed using
./mvnw testormvnw.cmdtest.
The source code is released under the MIT License. For details, see LICENSE_SOFTWARE.txt
Summary: This README provides a quick start guide for building, running, and configuring the project. Ensure you adapt the application.yml and environment variables to your environment, particularly the database and API keys.
Kite2Server ist ein Spring Boot (Java) Backend-Projekt mit REST-APIs für Datenverwaltung und GPT-Integration.
Kurzüberblick
- Java: 17
- Spring Boot: 3.x (Parent im
pom.xml3.1.0) - Hauptklasse:
com.hhn.kite2server.Kite2ServerApplication - Build Tool: Maven (
./mvnw/mvnw.cmdauf Windows)
Inhalt dieser README
- Voraussetzungen
- Build & Start
- Konfiguration
- Wichtige Module / Controller
- Troubleshooting
- JDK 17 installiert und in PATH
- Maven (oder das mitgelieferte Wrapper-Skript
mvnw/mvnw.cmd) - PostgreSQL (oder eine konfigurierte Datenbank)
Auf Windows (Powershell):
# Build
.\mvnw.cmd clean package
# Starten (erzeugte JAR im Ordner target, finalName = Kite2Server)
java -jar .\target\Kite2Server.jar
# Alternativ direkt mit dem Maven Spring Boot Plugin (zum Entwickeln)
.\mvnw.cmd spring-boot:runAuf Unix/macOS:
./mvnw clean package
java -jar ./target/Kite2Server.jarFür Tests:
.\mvnw.cmd testZentrale Konfiguration liegt in src/main/resources/application.yml. Wichtige Punkte:
server.port: Standard 8080spring.datasource.*: JDBC URL, Nutzer und Passwort (aktuell Beispielwerte — unbedingt anpassen)openai.api.keybzw. Umgebungsvariablen: Das Projekt nutztspring-dotenv— sensitive Keys sollten in einer.envliegen oder als Umgebungsvariablen gesetzt werden. Wichtige Variablen:OPENAI_API_KEY(API-Key für GPT)OPENAI_MODEL(z. B.gpt-4o)API_USERNAME/API_PASSWORD(falls genutzt)
- SSL-Keystore:
src/main/resources/keystore/keystore.p12(optional; imapplication.ymlals Kommentar vorhanden)
Wichtig: Die im Repository vorhandenen Beispielpasswörter sind Platzhalter. Niemals sensible Daten ins Repo committen.
Das Projekt ist in Pakete unter com.hhn.kite2server strukturiert. Wichtige Subpakete und Controller (nicht vollständig):
data—DataController,DataService,DataRepositorygpt—GptController,GptService,GptConfig
Die Hauptklasse ist com.hhn.kite2server.Kite2ServerApplication.
Das Projekt implementiert einen mehrschichtigen Sicherheitsansatz zum Schutz der API-Endpunkte:
- Alle Anfragen werden mit HMAC-SHA256-Signaturen validiert
- Der Validator prüft:
- Timestamp-Header: Stellt sicher, dass die Anfrage nicht älter als 5 Minuten ist (MAX_TIMESTAMP_AGE_SECONDS = 300)
- Signature-Header: Validiert die HMAC-SHA256-Signatur, die aus Timestamp und Secret-Key berechnet wird
- Secret Key: Konfiguriert über
security.kite.hmac-secretProperty
- Die Validierung wird durch die
HmacRequestValidator-Komponente durchgeführt
- Eine zusätzliche Passphrase ("Shared Secret") wird verwendet, um unbefugten Zugriff auf KI-Funktionen zu verhindern
- Die Passphrase wird über
security.kite.passphraseProperty konfiguriert - Validiert durch
AuthServicemittels direktem Vergleich - Kontrolliert den Zugriff auf GPT/KI-Endpunkte
- Nach erfolgreicher Authentifizierung erhalten Clients einen temporären Session-Token
- Tokens werden via
POST /api/auth/sessionEndpunkt erstellt - Token-Gültigkeitsdauer: 10 Minuten (600 Sekunden)
- Tokens werden in einer
ConcurrentHashMapgespeichert und automatisch bei Ablauf bereinigt - Verwaltet durch
TempTokenService
Fügen Sie folgende Einstellungen zu Ihrer application.yml hinzu:
security:
kite:
hmac-secret: "your-secret-key-here"
passphrase: "your-passphrase-here"- Actuator ist aktiviert (exposed endpoints konfigurierbar in
application.yml) - Access-Logs sind in
application.ymlkonfiguriert (Tomcat accesslog)
- Datenbankverbindung schlägt fehl: Prüfe
spring.datasource.url, Nutzer, Passwort und ob Postgres erreichbar ist. - TLS/SSL: Falls mit SSL gestartet werden soll,
server.ssl.enabled: truesetzen undkey-store/key-store-passwordkonfigurieren.
- Branch-Workflow: Feature-Branches, PRs gegen
main. - Code-Format: Projekt nutzt Standard-Java-Formatierung; Nutzt Lombok in Teilen des Codes.
- Bitte keine Secrets committen — stattdessen
.envoder CI-Secret-Store verwenden.
- Unit- und Integrationstests lassen sich mit
./mvnw testbzw.mvnw.cmd testausführen.
Der Quellcode steht unter der MIT-Lizenz. Details siehe LICENSE_SOFTWARE.txt
Kurzzusammenfassung: Diese README bietet einen schnellen Einstieg zum Bauen, Starten und Konfigurieren des Projekts. Passe application.yml und Umgebungsvariablen an deine Umgebung an, insbesondere DB- und API-Keys.