A comprehensive user management and authentication REST API built with Java, Spring Boot, and PostgreSQL. Manages user profiles, authentication, authorization, roles, and permissions.
Features
Feature
Description
Icon
User Registration
Create user accounts with email verification
βοΈ
Authentication
OAuth2, JWT, and session-based authentication
π
Passkey Authentication
WebAuthn/FIDO2 passwordless authentication support
π
Social Login
OAuth2 integration with popular social providers
π₯
Authorization
Role-based and attribute-based access control
π
Profile Management
Manage user information and preferences
π€
Password Management
Secure password reset and change mechanisms
π
Multi-Factor Auth
Support for 2FA, authenticator apps, and biometrics
π±
Multi-Tenant Support
Isolate users per tenant
π’
Architecture Overview
flowchart TD
A[Client] -->|REST API| B(UserController)
B --> C[AuthenticationService]
C --> D[UserService]
C --> E[AuthorizationService]
D --> F[UserRepository]
E --> G[RoleRepository]
F --> H[(PostgreSQL)]
G --> H
C --> I[JWT Provider]
C --> J[Email Service]
sequenceDiagram
participant U as User
participant API as UserController
participant Auth as AuthenticationService
participant US as UserService
participant Repo as UserRepository
participant Email as EmailService
U->>API: POST /users/register (email, password)
API->>Auth: validate input
Auth->>US: create user
US->>Repo: save user
Repo-->>US: user created
US->>Email: send verification email
Email-->>US: email queued
US-->>API: UserRegistrationResponse
API-->>U: 201 Created + user details
Note over U,Email: User verifies email
U->>API: POST /users/login (email, password)
API->>Auth: authenticate
Auth->>Repo: get user
Repo-->>Auth: user found
Auth->>Auth: verify password
Auth-->>API: JWT token
API-->>U: 200 OK + access token
Hold "Alt" / "Option" to enable pan & zoom
Database Schema
erDiagram
users {
UUID id PK
UUID tenant_id
VARCHAR email
VARCHAR username
VARCHAR password_hash
VARCHAR first_name
VARCHAR last_name
VARCHAR phone
VARCHAR avatar_url
VARCHAR status
BOOLEAN email_verified
TIMESTAMP created
TIMESTAMP updated
TIMESTAMP last_login
}
roles {
UUID id PK
UUID tenant_id
VARCHAR role_name
TEXT description
TIMESTAMP created
}
permissions {
UUID id PK
VARCHAR permission_name
TEXT description
TIMESTAMP created
}
user_roles {
UUID id PK
UUID user_id FK
UUID role_id FK
TIMESTAMP assigned_at
}
role_permissions {
UUID id PK
UUID role_id FK
UUID permission_id FK
TIMESTAMP assigned_at
}
users ||--o{ user_roles : "has"
roles ||--o{ user_roles : "assigned_to"
roles ||--o{ role_permissions : "has"
permissions ||--o{ role_permissions : "grants"