Skip to content

syxbruno/authentication-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Spring JWT Maven Docker MySQL FlyWay

authentication-project

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.


Project Overview

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.


Tech Stack

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

Application Endpoints

HelloController

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.

AuthController

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.

LoginGoogleController

GET /login/google Log in a user already registered using Google.

UserController

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.


How to Run the Application

  1. Clone the repository:

    git clone https://github.com/syxbruno/authentication-project.git
    cd authentication-project
    
  2. Build the Docker image of the REST API:

    mvn compile jib:dockerBuild
    
  3. Start the containers:

    docker-compose up
    
  4. REST API URL

    http://localhost:8080

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages