Skip to content

AamirrH/SecurityApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


🔐 SecurityApp – Spring Boot Security Demo

A basic Spring Boot Security web application that demonstrates core security concepts such as Authentication, Authorization, JWT-based security, CSRF protection, and Exception Handling.

This project is meant for learning and demonstration purposes, focusing on how modern backend security works rather than UI or frontend complexity.


✨ Features

  • ✅ User Authentication
  • ✅ Role-based Authorization
  • ✅ JWT (JSON Web Token) implementation
  • ✅ CSRF protection concepts
  • ✅ Secure REST APIs
  • ✅ Custom Exception Handling
  • ✅ Spring Security configuration from scratch

🛠️ Tech Stack

  • Java
  • Spring Boot
  • Spring Security
  • JWT
  • Maven

📂 Project Structure (High Level)

SecurityApp
│
├── src/main/java
│   ├── config        # Security & JWT configuration
│   ├── controller    # REST controllers
│   ├── service       # Business logic
│   ├── model         # Entities / DTOs
│   └── exception     # Custom exception handling
│
├── src/main/resources
│   └── application.properties
│
└── pom.xml

🔑 Authentication Flow (JWT)

  1. User sends login credentials
  2. Server validates credentials
  3. JWT is generated and returned
  4. Client sends JWT in Authorization header
  5. Server validates JWT for every secured request
Authorization: Bearer <JWT_TOKEN>

🚀 Getting Started

Prerequisites

  • Java 17+ (or compatible version)
  • Maven
  • IDE (IntelliJ / Eclipse recommended)

Run the Application

git clone https://github.com/your-username/SecurityApp.git
cd SecurityApp
mvn spring-boot:run

The app will start on:

http://localhost:8090

🔒 Security Concepts Covered

Authentication

Verifies who the user is using credentials and JWT.

Authorization

Controls what the user can access based on roles/permissions.

JWT

  • Stateless authentication
  • No session storage
  • Token-based security

CSRF

Explains how CSRF works and how Spring Security protects against it.


❗ Exception Handling

  • Centralized exception handling
  • Clean error responses
  • Improves API reliability and debugging

🧠 Why This Project?

  • To understand real-world backend security
  • To practice Spring Security internals
  • To build a strong foundation for scalable backend systems

🔮 Future Improvements

  • Refresh token support
  • Database-backed users & roles
  • OAuth2 integration

About

A hands-on learning project for understanding Spring Security internals — covers JWT authentication, role-based authorization, CSRF protection, and centralized exception handling. Built from scratch to develop a solid foundation in modern backend security concepts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors