This project is a monolithic application focused on user authentication and authorization. It manages the full user lifecycle, from registration and email verification to password reset and granting different permission levels.
The application uses a monolithic architecture based on the Spring Boot ecosystem, providing a robust solution for security management. The authentication system is built with JWT (JSON Web Tokens) for generating and validating access tokens and refresh tokens, ensuring security and session renewal without requiring multiple logins.
Data persistence is managed with Spring Data JPA and the MySQL database, with Flyway handling schema migrations. The application and the database are orchestrated with Docker to simplify the development environment.
| Category | Technology |
|---|---|
| Language | Java 21 |
| Frameworks | Spring (JPA, Validation, Web, DevTools, Security, Mail) |
| Authentication | JWT, OAuth (Google), Google authenticator |
| Containerization | Docker, Google JIB |
| Database | MySQL |
| Migrations | Flyway |
GET /student Returns "Hello Student" for users with the STUDENT role.
GET /teacher Returns "Hello Teacher" for users with the TEACHER role.
GET /director Returns "Hello Director" for users with the DIRECTOR role.
POST /login Authenticates a user with email and password in the request body.
POST /register Creates a new user with name, email, and password.
PATCH /verify Verifies the user's email using a code sent in the request body.
POST /update-token Generates a new access token using an existing refresh token.
POST /verify-a2f If A2F authentication is active, it authenticates a user via Google Authenticator.
GET /login/google Log in a user already registered using Google.
PATCH /add-profile/{id} Adds a role to the user with the specified ID. Requires the DEVELOPER role and a body containing
profilesName (STUDENT, TEACHER, or DIRECTOR).
POST /send-code Sends an email with a code for password reset.
PATCH /alter-password Resets the user's password with code, newPassword, and repeatPassword.
POST /a2f Enables A2F authentication and generates a qrcode.
PATCH /disable-a2f Disables A2F authentication for the logged in user.
-
Clone the repository:
git clone https://github.com/syxbruno/authentication-project.git cd authentication-project -
Build the Docker image of the REST API:
mvn compile jib:dockerBuild
-
Start the containers:
docker-compose up
-
REST API URL
http://localhost:8080