Skip to content

A project developed to deepen understanding of Spring Security and JWT in a Spring Boot application.

License

Notifications You must be signed in to change notification settings

arturbomtempo-learning/secure-rest-api-spring-boot-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SecureAuth API

SecureAuth API is a simple, introductory RESTful service designed to explore the fundamentals of token-based security with Spring Boot. Leveraging Spring Security and JWT, this project demonstrates basic user registration, authentication, and protected resource access, offering a hands-on learning experience for implementing secure Java backend applications.

Main project image

Made with Java NPM version Status: Local Development Complete MIT License

📋 Table of Contents

📝 Features

All API routes for the listed features have been fully developed and are functional. As this project is purely educational, there is no front-end implementation. Below is a detailed list of the features and their status:

  • User registration
  • User login
  • Client-only route access
  • Administrator-only route access
  • Token validation

📲 Application Demonstration

Since this is a backend API, you can test it locally using Insomnia or other API testing services like Postman. Below are the images showcasing the typical workflow:

  • Create a user

Create a user

  • Log in and obtain a JWT token

Log in and obtain a JWT token

  • Test general endpoints (token validation)

Test general endpoints (token validation)

  • Test client-only routes

Test client-only routes

  • Test admin-only routes with a client token (results in failure due to lack of admin permission)

Test admin-only routes with a client token

📁 Setup and Run the Application

⚙️ Prerequisites

Before starting, you need to have the following tools installed on your machine: Git and Java 21+.

It’s also recommended to use an IDE like Visual Studio Code (with the Java Extension Pack) or IntelliJ IDEA.

🚀 How to Run the Application

Back-End Setup

# Clone this repository
$ git clone https://github.com/ArturColen/secure-rest-api-spring-boot-jwt.git

# Navigate to the project folder
$ cd secure-rest-api-spring-boot-jwt

# Run the application
# Option 1: If using an IDE, open the project and run the main class (annotated with @SpringBootApplication)
# Option 2: If using the terminal, run the following command:
$ ./mvnw spring-boot:run

The server will start on port 8080 by default — you can now test the API using tools like Insomnia or Postman.

💻 Technologies

The following tools and frameworks were used in the development of this project:

  • Java: A high-level, class-based, object-oriented programming language designed for reliability and platform independence.
  • Spring Boot: A framework for building production-ready applications with minimal configuration.
  • Spring Data JPA: A module of Spring for data access using the Java Persistence API (JPA).
  • Spring Web: A module of Spring for building web applications, including RESTful services.
  • Spring Security: A powerful and customizable authentication and access-control framework.
  • Lombok: A Java library that helps reduce boilerplate code by generating common methods like getters and setters.
  • H2 Database: A lightweight, in-memory database often used for development and testing.
  • JWT (JSON Web Tokens): A compact, URL-safe means of representing claims to be transferred between two parties.
  • Auth0: A platform for implementing authentication and authorization in applications.

👨🏻‍💻 Author



Artur Bomtempo

Developed by Artur Bomtempo 👋🏻. Get in touch:

Gmail Badge LinkedIn Badge Instagram Badge

📜 License

Copyright (c) 2025 Artur Bomtempo Colen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A project developed to deepen understanding of Spring Security and JWT in a Spring Boot application.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages