This project demonstrates secure, token-based authentication built using Spring Boot, Kotlin, and JWT. The application is running on a free-tier EC2 instance, and it supports essential authentication operations such as user registration, login, password reset, and updating user information. Additionally, an Actuator server is available on port 8090 for monitoring and managing the application.
- User Registration: Register new users with email, password, and personal details.
- Login: Authenticate users via email and password, and generate JWT tokens for secure access.
- Password Reset: Send password reset tokens to user emails.
- Update User Info: Modify user details using the user ID.
- JWT-based Security: Protect API endpoints using JSON Web Tokens (JWT).
- User Management: List all users, read individual user details, and delete users by ID.
- Actuator Support: Monitor application health and performance using Spring Boot Actuator on port
8090.
-
Register User
POST /auth/register
Register a new user with the provided details. -
Login User
POST /auth/login
Authenticate a user using email and password. -
Forgot Password
POST /auth/forgot-password
Send a password reset token to the user’s email. -
Reset Password
POST /auth/reset-password
Reset the password using the provided token. -
Change Password
POST /auth/change
Change the password using the provided token.
-
List Users
GET /auth/users
Retrieve a list of all registered users. -
Read User
GET /auth/users/{id}
Retrieve a user's details using their ID. -
Update User
PUT /auth/users/{id}update
Update a user’s information by their ID. -
Delete User
DELETE /auth/users/{id}/delete
Delete a user from the system using their ID.
- Validate Token
GET /auth/validate-token?token={confirmationToken}
Validates different operations that uses token validation.
- Java 21 or later
- Kotlin
- Gradle
- Clone the repository:
git clone https://github.com/Kenato254/spring-kotlin-authentication-demo
- Navigate to the project directory:
cd spring-kotlin-authentication-demo - Build the project with Gradle:
./gradlew build
- Run the application:
./gradlew bootRun
The application will run locally at http://localhost:8080/api, and the Actuator endpoints will be accessible on http://localhost:8090.
The API is documented using OpenAPI/Swagger. After running the application, access the API documentation at:
http://localhost:8080/api/swagger-ui.html
This project is licensed under the MIT License.
For any issues or questions, reach out to:
- Name: Spring Kotlin Authentication Demo
- Email: [email protected]
- GitHub: Kenato254
Happy coding! 😊