AuthSystem is a user authentication system built with Spring Boot. It allows users to register, log in, and view a personalized welcome page. The application uses cookies to manage user sessions and PostgreSQL as the database.
- ✅ User registration with validation.
- 🔒 User login with authentication.
- 🎉 Personalized welcome page after login.
- 🍪 Cookies for session management.
- 📱 Responsive UI with Bootstrap.
authsystem/
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ ├── com.github.luizstsantos.authsystem/
│ │ │ │ ├── AuthsystemApplication.java # Main application entry point
│ │ │ │ ├── DataConfiguration.java # Database configuration
│ │ │ │ ├── controller/
│ │ │ │ │ └── loginController.java # Handles login, registration, and home routes
│ │ │ │ ├── model/
│ │ │ │ │ └── user.java # User entity
│ │ │ │ ├── repository/
│ │ │ │ │ └── UserRepository.java # Repository for user data
│ │ │ │ ├── service/
│ │ │ │ │ └── CookieService.java # Utility for managing cookies
│ │ ├── resources/
│ │ │ ├── templates/
│ │ │ │ ├── login.html # Login page
│ │ │ │ ├── register.html # Registration page
│ │ │ │ └── home.html # Welcome page after login
│ │ │ ├── application.properties # Application configuration
│ │ └── static/ # Static assets (if any)
├── pom.xml # Maven configuration
└── README.md # Project documentation
- Java 17: Programming language.
- Spring Boot: Framework for building the application.
- Spring MVC: For handling web requests.
- Spring Data JPA: For database interaction.
- PostgreSQL: Relational database for storing user data.
- Thymeleaf: Template engine for rendering HTML views.
- Bootstrap 4: For responsive and modern UI design.
- Jakarta Servlet API: For managing HTTP requests and responses.
- ☕ Java 17 or higher
- 🛠️ Maven
- 🐘 PostgreSQL
-
Clone the repository:
git clone https://github.com/luizstsantos/authsystem.git cd authsystem
-
Configure the database:
- Create a PostgreSQL database named
users
. - Update the
DataConfiguration.java
file with your database credentials:dataSource.setUrl("jdbc:postgresql://localhost:5432/users?serverTimezone=UTC"); dataSource.setUsername("your_username"); dataSource.setPassword("your_password");
- Create a PostgreSQL database named
-
Build and run the application:
mvn spring-boot:run
-
Access the application:
- Open your browser and go to
http://localhost:8080/login
.
- Open your browser and go to
- GET /login: Displays the login page.
- POST /login: Authenticates the user and redirects to the home page.
- GET /register: Displays the registration page.
- POST /register: Registers a new user and redirects to the login page.
- GET /home: Displays the personalized welcome page.
This project is licensed under the MIT License. See the LICENSE file for details.
- Luiz Santos - GitHub Profile