Registration, login, and JWT issuance for the Library Booking System. Persists no credentials locally; user records and password checks are delegated to user-service.
flowchart LR
Client --> GW[api-gateway]
GW --> AUTH[auth-service]
AUTH --> USER[user-service]
AUTH --> JWT[JWT to client]
| Concern | Owner |
|---|---|
| User storage | user-service |
| Password validation | user-service (internal API) |
| Token signing | auth-service (JWT_SECRET, JWT_EXPIRATION) |
Base path: http://localhost:8080/api/auth
| Method | Path | Description |
|---|---|---|
| POST | /register |
Create account (may require faculty/admin approval before login) |
| POST | /login |
Authenticate and receive JWT |
| GET | /validate |
Validate a bearer token |
| GET | /health |
Service health |
See API_REFERENCE.md for request and response shapes.
- Java 17, Spring Boot 3.5
- Spring Security, Validation, AOP
- JJWT
- common-aspects for shared security primitives
| Variable | Default | Purpose |
|---|---|---|
USER_SERVICE_URL |
http://localhost:3001 |
user-service base URL |
JWT_SECRET |
dev default in application.yaml |
HMAC signing key |
JWT_EXPIRATION |
3600000 |
Token lifetime (ms) |
HTTP port 3002 (server.port).
With Docker Compose (recommended):
cd docker-compose
docker compose up -d auth-serviceStandalone: start user-service and its database first, then:
mvn spring-boot:runBuild the shared library first if you are not using the vendored JAR in the service libs/ folder:
cd common-aspects
mvn install- user-service — account data and internal auth hooks
- api-gateway — public entry on port 8080
- Documentation — system overview and API reference