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.
- About
- Table of Contents
- Features
- Application Demonstration
- Setup and Run the Application
- Technologies
- Author
- License
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
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
- Log in and obtain a JWT token
- Test general endpoints (token validation)
- Test client-only routes
- Test admin-only routes with a client token (results in failure due to lack of admin permission)
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.
# 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:runThe server will start on port 8080 by default — you can now test the API using tools like Insomnia or Postman.
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.
Artur Bomtempo |
|---|
Developed by Artur Bomtempo 👋🏻. Get in touch:
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.




