Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Service

A Spring Boot microservice that handles user identity for a small e-commerce platform: sign up, login, logout, password/session validation, and role management. It also acts as an OAuth2/OIDC authorization server (via Spring Authorization Server) so other services can validate JWT-based sessions issued by this service.

This service is part of a small e-commerce microservices suite together with paymentservice and productservice_proxy.

Features

  • User sign up and login (AuthController)
  • Logout and session/token validation
  • Role management for users (RoleController, UserController)
  • Password hashing via BCryptPasswordEncoder
  • JWT issuance/validation using io.jsonwebtoken (JJWT)
  • OAuth2/OIDC Authorization Server support (Spring Authorization Server), including JPA-backed client, authorization, and consent repositories
  • Database schema migrations via Flyway

API Endpoints

Method Path Description
POST /auth/signup Create a new user account
POST /auth/login Authenticate a user and issue a session
POST /auth/logout Invalidate an existing session
POST /auth/validate Validate a session token
GET /users/{id} Fetch a user's details
POST /users/{id}/roles Assign roles to a user

Tech Stack

  • Java 17, Spring Boot 3.1.4
  • Spring Data JPA / Spring Data JDBC
  • Spring Security + Spring Authorization Server (OAuth2/OIDC)
  • MySQL (via mysql-connector-j)
  • Flyway for database migrations
  • JJWT for JWT handling
  • Lombok

Setup

Prerequisites

  • Java 17
  • Maven (or use the bundled ./mvnw)
  • A MySQL instance

Configuration

Database connection and OAuth2 client settings are configured in src/main/resources/application.properties. Update the datasource URL, username, and password for your local MySQL instance before running the service. Do not commit real credentials — use environment variables or a local override for anything sensitive.

Run

./mvnw spring-boot:run

The service starts on the default Spring Boot port (8080) unless overridden.

Test

./mvnw test

License

Released under the MIT License.

About

A micro service to handle user related functionalities like, sign up, sign in, viewing profile, resetting password

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages