Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sandeepkv93/user-management-springboot
https://github.com/sandeepkv93/user-management-springboot
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sandeepkv93/user-management-springboot
- Owner: sandeepkv93
- Created: 2024-11-12T02:39:28.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-12T02:43:51.000Z (about 2 months ago)
- Last Synced: 2024-11-12T03:29:06.205Z (about 2 months ago)
- Language: Java
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://github.com/sandeepkv93/user-management-springboot/actions/workflows/ci.yml/badge.svg)](https://github.com/sandeepkv93/user-management-springboot/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/sandeepkv93/user-management-springboot/branch/main/graph/badge.svg?token=CODECOV_TOKEN_HERE)](https://codecov.io/gh/sandeepkv93/user-management-springboot)# ๐ User Management Service
A powerful Spring Boot application for managing users with OAuth2 social login and AWS S3 integration! ๐
## โจ Features
### ๐ฏ Core Features
- ๐ JWT Authentication & Authorization
- ๐ OAuth2 Social Login (Google & GitHub)
- ๐ค User Profile Management
- ๐ผ๏ธ Profile Picture Storage (AWS S3)
- ๐ Role-Based Access Control
- ๐ Token Refresh Mechanism### ๐ ๏ธ Technical Stack
- โ Java 21
- ๐ Spring Boot 3.2
- ๐ PostgreSQL 16
- ๐ณ Docker & Docker Compose
- ๐ฆ LocalStack (S3 Emulation)
- โ๏ธ Flyway Migrations## ๐๏ธ Architecture
```mermaid
flowchart TB
Client[Client Applications]
Auth[Authentication Service]
User[User Service]
S3[S3 Service]
DB[(PostgreSQL)]
S3Store[(S3 Storage)]Client -->|Authentication Requests| Auth
Client -->|User Management| User
Auth -->|User Data| DB
User -->|Profile Data| DB
User -->|Profile Pictures| S3
S3 -->|Store/Retrieve| S3Storestyle Client fill:#f9f,stroke:#333,stroke-width:4px
style Auth fill:#bbf,stroke:#333,stroke-width:2px
style User fill:#bbf,stroke:#333,stroke-width:2px
style S3 fill:#bbf,stroke:#333,stroke-width:2px
style DB fill:#bfb,stroke:#333,stroke-width:2px
style S3Store fill:#bfb,stroke:#333,stroke-width:2px
```### ๐ Authentication Flow
```mermaid
sequenceDiagram
actor User
participant Client
participant Auth
participant DB
User->>Client: Login Request
Client->>Auth: Authenticate
Auth->>DB: Validate Credentials
DB-->>Auth: User Data
Auth-->>Client: JWT + Refresh Token
Client-->>User: Login Success
Note over User,DB: Token Refresh Flow
Client->>Auth: Refresh Token
Auth->>DB: Validate Refresh Token
DB-->>Auth: Token Valid
Auth-->>Client: New JWT
```## ๐ Getting Started
### ๐ Prerequisites
- โ Java 21
- ๐ฆ Maven
- ๐ณ Docker & Docker Compose
- ๐ PostgreSQL 16
- ๐ป Your favorite IDE!### ๐ง Setup
1. **๐ฅ Clone the Repository**
```bash
git clone
cd user-management
```2. **๐ณ Start Infrastructure**
```bash
docker-compose up -d
```3. **๐ฏ Initialize S3**
```bash
chmod +x scripts/init-localstack.sh
./scripts/init-localstack.sh
```4. **โ๏ธ Configure Application**
Create `application.yml` with your settings:
```yaml
spring:
datasource:
url: jdbc:postgresql://localhost:5432/user_management
username: user
password: passwordapp:
jwt:
secret: ${JWT_SECRET:your-secret-key}
aws:
s3:
bucket-name: user-profiles
```5. **๐ Build & Run**
```bash
mvn clean install
mvn spring-boot:run
```## ๐ API Reference
### ๐ Authentication
#### ๐ Register
```http
POST /api/auth/signup
{
"username": "cooluser123",
"email": "[email protected]",
"password": "secure123!"
}
```#### ๐ Login
```http
POST /api/auth/login
{
"email": "[email protected]",
"password": "secure123!"
}
```### ๐ค User Management
#### ๐ฑ Get Profile
```http
GET /api/users/me
Authorization: Bearer
```#### ๐ผ๏ธ Update Profile Picture
```http
POST /api/users/me/profile-picture
Authorization: Bearer
Content-Type: multipart/form-data
```### ๐ OAuth2 Login
#### ๐ท Google
```http
GET /oauth2/authorization/google
```#### ๐ฑ GitHub
```http
GET /oauth2/authorization/github
```## ๐ Security Features
### ๐ Authentication
- ๐๏ธ JWT Tokens (1 hour validity)
- ๐ Refresh Tokens (30 days validity)
- ๐ BCrypt Password Encryption### ๐ฎ Authorization
- ๐ฅ Role-Based Access Control
- ๐ก๏ธ Method-Level Security
- ๐ซ CORS Protection## ๐งช Testing
```bash
# ๐งช Run all tests
mvn test# ๐ Generate coverage report
mvn verify
```## ๐ง Development
### ๐ Code Style
```bash
# ๐จ Format code
mvn com.spotify.fmt:fmt-maven-plugin:format
```### ๐ Database Migrations
```bash
# ๐ Run migrations manually
mvn flyway:migrate
```