A simple and secure backend system for user registration and login, built as part of a backend internship challenge.
- User Registration with Full Name, Email, and Password
- Secure Login with password hashing (BCrypt)
- JWT-based Authentication
- Stateless security using Spring Security
- MySQL Database integration
- Input validation and error handling
- Language: Java 21
- Framework: Spring Boot
- Security: Spring Security + JWT (jjwt)
- Database: MySQL
- ORM: Spring Data JPA + Hibernate
- Build Tool: Maven
- API Testing: Postman
- Java 21+
- Maven
- MySQL
- IDE (e.g. IntelliJ)
- Postman (for testing)
-
Clone the repository
git clone https://github.com/KrishNatrium/AuthDemo.git cd authdemo -
Create MySQL Database
CREATE DATABASE authdb;
-
Update
application.propertiesspring.datasource.username=your_mysql_user spring.datasource.password=your_mysql_password -
Run the Application
- Open in IntelliJ
- Run
DemoApplication.java - App runs at:
http://localhost:9090
POST /api/auth/register
Request Body:
{
"fullName": "Krishna Gopal Kar",
"email": "krishna@example.com",
"password": "password123"
}Returns: JWT token
POST /api/auth/login
Request Body:
{
"email": "krishna@example.com",
"password": "password123"
}Returns: JWT token
You can register any credentials, but here's one:
- Protected routes (e.g.
/api/user/me) - Docker Support
- Role-based authorization
Krishna Gopal Kar B.Tech CSE | KIIT DU LinkedIn GitHub
