Skip to content

musatDev/TicketTrackSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎫 TicketTrack

(Spring Boot Ticket Management REST API developed to improve and demonstrate Spring Security concepts such as JWT authentication, role-based authorization, owner-based access control, and audit logging with PostgreSQL.)

TicketTrack is a secure, role-based Ticket Management REST API built with Spring Boot.
It demonstrates authentication, authorization, audit logging, and owner-based access control using JWT and PostgreSQL.

🚀 Tech Stack

  • Java 21
  • Spring Boot 3
  • Spring Security
  • JWT (Stateless Authentication)
  • Spring Data JPA (Hibernate)
  • PostgreSQL
  • Maven

🔐 Authentication & Security

TicketTrack uses JWT-based stateless authentication.

Roles

  • ADMIN
  • MANAGER
  • USER

Authorization Rules

Operation USER MANAGER ADMIN
Create Ticket
View Tickets
Update Own Ticket
Update Any Ticket
Delete Own Ticket
Delete Any Ticket
View Audit Logs

🏗 Architecture

Layered architecture: Controller → Service → Repository → Database ↓ Audit ↓ Security (JWT + Role + Owner)

Modules

  • ticket → Ticket management
  • user → User & role management
  • security → JWT authentication & authorization
  • audit → Action logging
  • common → Base entity & shared logic

📌 Features

  • JWT Authentication
  • Role-based Authorization
  • Owner-based Access Control
  • Audit Logging (CREATE / UPDATE / DELETE)
  • Global Exception Handling
  • DTO-based request/response separation
  • PostgreSQL integration
  • BCrypt password hashing

🔑 Authentication Flow

1️⃣ Login

POST /api/auth/login

Request: json { "username": "user", "password": "userpass" }

Response: { "token": "JWT_TOKEN" }

2️⃣ Use Token Add to request header: Authorization: Bearer <JWT_TOKEN>

🎫 Ticket Endpoints Create Ticket POST /api/tickets Get All Tickets GET /api/tickets Get Ticket by ID GET /api/tickets/{id} Update Ticket PUT /api/tickets/{id} Delete Ticket DELETE /api/tickets/{id} 📋 Audit Endpoint GET /api/audit Accessible only by ADMIN.

🛢 Database PostgreSQL database name: tickets Example configuration (application.yml): spring: datasource: url: jdbc:postgresql://localhost:5432/tickets username: your_username password: your_password

▶ Running the Project Start PostgreSQL Create database Run the application: ./mvnw spring-boot:run

About

TicketTrack – A secure Spring Boot REST API featuring JWT authentication, role-based authorization, owner-based access control, and audit logging with PostgreSQL.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages