-
Notifications
You must be signed in to change notification settings - Fork 0
First Page ‐ Project Overview
Project Name: ktx-audit-service
🔹 This project provides a flexible and modular security event logging system based on Hexagonal Architecture.
🔹 It is designed to be decoupled from specific storage and messaging technologies, making it adaptable to various environments.
🔹 The system logs security-related events (e.g., failed logins, account lockouts) and publishes them to a message broker (Kafka) for further processing.
This project follows the Hexagonal Architecture (Ports & Adapters) pattern, ensuring loose coupling between components.
| Component | Responsibility |
|---|---|
| 🔹 ktx-core | Defines interfaces (ports) for event logging and messaging. No concrete implementation. |
| 🔹 SecurityEventService | Handles security event logging and publishing to Kafka. |
| 🔹 SecurityEventRepository | Adapter for MySQL persistence, storing security events. |
| 🔹 SecurityEventProducer | Adapter for Kafka, responsible for publishing events. |
+--------------------------------+
| Application Layer (Ports) |
|--------------------------------|
| - SecurityEventService |
| - KtxEventService<T> |
+--------------------------------+
|
v
+--------------------------------------------------+
| Infrastructure Layer (Adapters) |
|--------------------------------------------------|
| 🔹 SecurityEventRepository -> MySQL Adapter |
| 🔹 SecurityEventProducer -> Kafka Adapter |
+--------------------------------------------------+
|
v
+--------------------------------------------------+
| External Systems |
|--------------------------------------------------|
| - MySQL Database |
| - Kafka Message Broker |
+--------------------------------------------------+
1️⃣ Security Events are Generated
- Example: A failed login attempt triggers an event.
2️⃣ Events are Logged & Persisted
-
SecurityEventServicesaves the event usingKtxEventService<T>. - The underlying persistence is managed by the appropriate adapter (e.g., MySQL via
SecurityEventRepository).
3️⃣ Events are Published to Kafka
-
SecurityEventProducerpushes the event to thesecurity-eventsKafka topic. - Other microservices can consume and react to security-related events.
The project is structured into multiple modules:
- Contains only interfaces (ports).
- Enables plug-and-play architecture where modules can inject implementations dynamically.
- Implements the event logging and persistence logic.
- Uses
SecurityEventRepositoryfor MySQL andSecurityEventProducerfor Kafka.
- Planned module that will apply security policies (e.g., account lockout, brute-force prevention).
Ensure you have:
✅ Java 17+
✅ Maven
✅ Docker (for MySQL & Kafka setup)
docker-compose up -d
This starts MySQL, Kafka, and Zookeeper.
mvn spring-boot:run
🔹 [ ] Clarify SecurityService Role: Should it handle security enforcement?
🔹 [ ] Make Security Configurable: Define thresholds for event-driven security rules.
🔹 [ ] Improve Documentation: Expand Wiki with event payload examples, API usage, and architecture deep dive.
📌 🔗 GitHub Repository
📌 🔗 API Documentation (Swagger)
📌 🔗 Kafka Management UI