This is a microservices-based task management system built with Spring Boot and Spring Cloud Gateway. It allows users to register, log in, and manage their tasks securely using JWT authentication.
- Handles user registration, login, and JWT authentication.
- Issues JWT tokens containing the
userIdupon login. - Validates JWT tokens for security.
- Endpoints:
POST /auth/register– Register a new user.POST /auth/login– Authenticate a user and return a JWT.GET /auth/validate– Validate a JWT token.GET /auth/user– Retrieve user information from JWT.
- Manages tasks for authenticated users.
- Supports CRUD operations:
POST /tasks– Create a new task.GET /tasks– Get all tasks for the current user.GET /tasks/{id}– Get a specific task by ID.PUT /tasks/{id}– Update an existing task.DELETE /tasks/{id}– Delete a task.
- Extracts
userIdfrom JWT to ensure user-specific task access.
- Routes requests to the appropriate service.
- Validates JWT tokens before forwarding requests.
- Handles cross-cutting concerns like CORS and security.
- Routes configured:
/auth/**→ Auth Service/api/tasks/**→ Task Service
-
User Registration & Login
- User registers via Auth Service.
- Logs in to receive a JWT token.
-
Task Operations
- All task requests go through the API Gateway.
- Gateway validates the JWT token.
- Task Service extracts
userIdfrom the token. - CRUD operations are performed only for the authenticated user.
- Token-based authentication (JWT)
- Microservices architecture with API Gateway routing
- Secure, per-user task access
- No repeated calls to Auth Service per request
server:
port: 4000
jwt:
secret: V1JkR2F5bU9XbXhZcVBlTmRWRWl3aXhqY2N0ZkZsU1o=
auth:
service:
url: http://localhost:4001
spring:
cloud:
gateway:
server:
webflux:
routes:
- id: auth-service-route
uri: http://localhost:4001
predicates:
- Path=/auth/**
filters:
- StripPrefix=1
- id: task-service-route
uri: http://localhost:4002
predicates:
- Path=/api/tasks/**
filters:
- StripPrefix=1
- JwtValidation-
Spring Boot
-
Spring Data JPA (H2)
-
Spring Cloud Gateway
-
JWT (io.jsonwebtoken)
-
Java 21
-
Angular