Architecture
High-level system architecture and authentication process flow.
System Overview
The arya-banking-auth-service resides at the core of the Arya Banking platform, facilitating communication between the rest of the services and Keycloak. It now participates in the event-driven architecture via Kafka for asynchronous user lifecycle events.
Authentication Flow
Public API Authentication
When a user attempts to log in, the following flow is executed:
- The client sends credentials to the Gateway.
- The Gateway routes the request to
/api/auth/authenticate. - The Auth Service validates the credentials via a
passwordgrant to Keycloak. - If successful, the JWT is returned to the client.
Cross-Service Account Lock
A critical part of the architecture is the account lock synchronization between the User Service and Keycloak:
0/0
Event-Driven Account Lock (New)
Login failures are also published as Kafka events for audit and downstream processing:
0/0
Kafka Event Flow
Producer: User Registration
0/0
Consumer: User Update Event
0/0
Technical Components
- Keycloak Admin SDK: Used to perform administrative actions (e.g., user creation and account status updates).
- RestTemplate (Pooled): High-performance HTTP client for token exchanges.
- Feign Clients: Manage communication with the User Service for account security synchronization.
- Resource Server: Validates incoming JWTs for internal service-to-service calls.
- Kafka Configuration:
KafkaListenerConfigprovides sharedConcurrentKafkaListenerContainerFactoryviaarya-banking-common. - Event Producers:
UserEventProducerpublishesUserCreateEventandLoginFailedEventwith Avro serialization. - Event Consumers:
UserUpdateEventListenerconsumesUserCreateEventfrom User Service outbox topic.