How ndlam0211/auth-service works
Project type and purpose
• This is a Java-based microservices system composed of:
• api-gateway – Spring Cloud Gateway
• auth-service – a JWT/RBAC authentication & authorization microservice
• eureka-server – Spring Cloud Netflix Eureka service registry
• Purpose: route client traffic, secure endpoints via JWT and roles, and perform service discovery.
File structure
• Three top-level modules, each with its own Maven wrapper and pom.xml:
• api-gateway: HTTP entrypoint, routing rules in GatewayConfig.java
• auth-service: full Spring Boot app with controllers, services, repositories, JWT filter, Flyway migrations
• eureka-server: simple Spring Boot Eureka registry
• The presence of application.yml/properties in each suggests per-service configuration.
• auth-service uses Flyway (db/migration) to initialize its database schema.
Key architecture patterns
• Microservices with centralized service registry (Eureka)
• API Gateway pattern for routing and cross-cutting concerns (security, CORS)
• Token-based authentication (JWT)
• Role-based access control via annotations and AOP (PermissionAspect)
Main components and how they interact
a. Clients (web/mobile)
b. API Gateway
c. Service Registry (Eureka)
d. Auth Service
e. Auth Service’s relational Database
f. (Future) downstream microservices
Interaction flow:
1. Client → API Gateway: all HTTP requests pass through the gateway.
2. API Gateway ↔ Eureka: on startup & periodically fetches the list of registered services.
3. API Gateway → Auth Service: routes authentication-related endpoints (e.g., /login, /refresh, /users).
4. Auth Service ↔ Database: persistent storage for users, tokens, permissions.
5. Auth Service returns JWT to Client via Gateway.
6. Subsequent Client calls include JWT → API Gateway, which validates or forwards to Auth Service’s JwtAuthFilter.
Final checklist
• [ ] All components labeled (Client, API Gateway, Eureka Server, Auth Service, Auth DB)
• [ ] Annotations for key frameworks/patterns (JWT, RBAC, Flyway migrations)