Secure File Server System Using Spring Boot and JWT Authentication
Student Name : Krushna Prakash Rahate
College : Government College of Engineering Chhatrapati Sambhajinagar
Project Github Link : [Link]
Introduction :
The Secure File Server System is a cross-platform, GUI-based application developed using Java and
Spring Boot. The system allows authenticated users to securely upload, download, and manage files
over a network. It supports multiple users with separate accounts and role-based access control to
ensure secure file management.
The main purpose of this project is to provide a reliable and secure file-sharing platform with proper
authentication and authorization mechanisms. The application uses JWT-based authentication and
Spring Security to protect user data and prevent unauthorized access.
This project solves common problems found in traditional file-sharing systems, such as lack of
security, unauthorized file access, and absence of user activity monitoring. The system also includes
activity logging, ownership validation, and admin management features to improve system reliability
and accountability.
Objectives :
1. To develop a secure file server system for uploading, downloading, and managing files.
2. To implement user authentication and authorization using JWT and Spring Security.
3. To provide reliable multi-user access with user-specific file management.
4. To ensure file security through ownership validation and role-based access control.
5. To maintain user activity logs for monitoring and accountability.
6. To create a cross-platform application that can run on Windows, Linux, and macOS.
7. To design a simple GUI-based interface for easy interaction between users and the system.
8. To build a scalable backend architecture using Spring Boot and MySQL.
Technology Used :
1. Java
- Core programming language used for backend development.
2. Spring Boot
- Framework used to build the backend application and REST APIs.
3. Spring Security
- Used for authentication and authorization.
4. JWT (JSON Web Token)
- Used for secure user authentication and stateless session management.
5. MySQL
- Database used to store user details, file information, and activity logs.
6. Hibernate / JPA
- Used for object-relational mapping and database operations.
7. Thymeleaf
- Used for creating dynamic frontend pages.
8. HTML, CSS, JavaScript
- Used for frontend development and user interaction.
9. Bootstrap
- Used for responsive and user-friendly UI design.
System Architecture :
The Secure File Server System follows a layered client-server architecture. The system consists of a
frontend interface, backend application, security layer, and database layer.
1. Frontend Layer
- Developed using Thymeleaf, HTML, Bootstrap, and JavaScript.
- Provides GUI pages such as Login, Signup, Dashboard, Activities, and Admin Dashboard.
- Sends HTTP requests to backend APIs.
2. Backend Layer
- Developed using Spring Boot.
- Handles business logic, file operations, authentication, authorization, and activity logging.
- Uses REST APIs for communication between frontend and backend.
3. Security Layer
- Implemented using Spring Security and JWT Authentication.
- Verifies user identity and protects APIs from unauthorized access.
- Supports role-based access control for USER and ADMIN roles.
4. Database Layer
- MySQL database is used for storing:
- User details
- File metadata
- Activity logs
- Hibernate/JPA is used for database interaction.
5. File Storage Layer
- Uploaded files are stored physically inside the uploads directory on the server.
- File paths are stored in the database for retrieval and management.
System Flow:
User → Frontend GUI → Spring Boot APIs → Security Validation → Database/File Storage →
Response to User
Features :
1. User Registration and Login
- Users can create accounts and securely log in to the system.
2. JWT-Based Authentication
- Secure authentication is implemented using JSON Web Tokens (JWT).
3. Role-Based Access Control
- Separate roles for USER and ADMIN with different permissions.
4. File Upload
- Authenticated users can upload files to the server.
5. File Download
- Users can securely download their uploaded files.
6. File Deletion
- Users can delete their own files from the system.
7. Multi-User Support
- Multiple users can access the system independently with separate file management.
8. Ownership Validation
- Users cannot access or delete files belonging to other users.
9. Activity Logging
- The system records user activities such as LOGIN, UPLOAD, DOWNLOAD, and DELETE.
10. Admin Dashboard
- Admin can view all users, monitor activities, and manage user accounts.
11. Cross-Platform Support
- Application can run on Windows, Linux, and macOS environments.
12. GUI-Based Interface
- User-friendly frontend developed using Thymeleaf and Bootstrap.
13. Database Integration
- MySQL database stores user details, file information, and activity logs.
14. Secure Password Storage
- Passwords are encrypted using BCrypt hashing.
15. Physical File Storage
- Uploaded files are stored securely in the server upload directory.
Security Features :
1. JWT Authentication
- The system uses JSON Web Token (JWT) authentication to securely verify users and protect APIs
from unauthorized access.
2. Spring Security Integration
- Spring Security is implemented to manage authentication and authorization throughout the
application.
3. Password Encryption using BCrypt
- User passwords are encrypted using BCrypt hashing before storing them in the database.
4. Role-Based Access Control (RBAC)
- The application supports USER and ADMIN roles with different access permissions.
5. Ownership Validation
- Users can only access, download, or delete their own files.
6. Protected APIs
- All sensitive APIs are secured and accessible only to authenticated users.
7. Stateless Authentication
- JWT-based stateless authentication eliminates server-side session dependency and improves
security.
8. Secure File Management
- File operations such as upload, download, and delete are validated using authenticated user
identity.
9. Activity Logging
- User activities such as LOGIN, UPLOAD, DOWNLOAD, and DELETE are recorded for monitoring and
accountability.
10. Admin Authorization
- Administrative operations are restricted only to users with ADMIN role.
11. Unauthorized Access Prevention
- The system blocks unauthorized users from accessing protected resources and admin
functionalities.
12. Secure Multi-User Environment
- Multiple users can safely use the system without accessing each other’s data.
JWT Token Stored in Browser Local Storage After Authentication :
Unauthorized User Restricted from Admin Access :
User Passwords Stored in BCrypt Encrypted Format :
Database Design :
The application uses MySQL as the backend database to store user information, file metadata, and
activity logs. The database is designed using relational tables with proper relationships between
entities.
1. tbl_user
- Stores user account details.
Fields:
- user_id (Primary Key)
- username
- password
- email
- role
- enabled
2. file_data
- Stores uploaded file information.
Fields:
- id (Primary Key)
- file_name
- file_type
- file_path
- file_size
- upload_time
- user_id (Foreign Key)
3. activity
- Stores user activity logs.
Fields:
- id (Primary Key)
- username
- action
- file_name
- time
Relationships:
- One user can upload multiple files.
- One user can perform multiple activities.
- file_data table is connected to tbl_user using user_id as foreign key.
Database Features:
- Supports multi-user file management.
- Maintains ownership information for uploaded files.
- Stores activity logs for monitoring and auditing.
- Provides secure and structured data management using relational design.
Screenshots :
1. Signup page
2. Login page
3. Dashboard page
4. Activity page
5. Admin page
Conclusion :
The Secure File Server System successfully provides a secure and reliable platform for file
management using modern backend technologies. The project implements user authentication, role-
based authorization, secure file handling, and activity monitoring to ensure safe multi-user access.
The application allows users to upload, download, and manage files through a simple GUI-based
interface developed using Thymeleaf and Bootstrap. Security is enhanced using JWT authentication,
Spring Security, BCrypt password encryption, and ownership validation mechanisms.
The system also includes an admin dashboard for monitoring users and activities, making the
application more scalable and manageable. By following a layered architecture and using Spring Boot
with MySQL, the project demonstrates strong backend system design and secure application
development practices.
Overall, the project fulfills the objectives of creating a cross-platform, secure, and multi-user file
server system with efficient file management and reliable access control.