- This backend application, developed using Spring Boot 3.3.0 and Spring Security 6.X.X.
- implements a role-based (User/Admin) registration and login system.
- It leverages Caffeine cache for storing OTPs sent via email for verification purposes.
- Upon successful registration, the application generates JWT tokens: an access token (valid for 1 hour) and a refresh token (valid for 30 days).
- These tokens are used to authorize users, ensuring that only verified users with valid tokens can access certain endpoints outside of the "/api/v1/auth/**" path.
- To enhance reliability, a retry mechanism is implemented for email sending, which attempts to resend the OTP up to two more times in case of a system failure.
- Additionally, the application includes robust validation checks, ensuring that request bodies meet the required criteria.
To use the REST_APIs use this url
https://jwt-authentication-authorization-for.onrender.com/
spring-boot-starter-web
spring-boot-starter-data-jpa
spring-boot-starter-mail
spring-boot-starter-security
spring-boot-starter-validation
springdoc-openapi-starter-webmvc-ui
postgresql
lombok
spring-retry
jjwt
jjwt-impl
jjwt-api
spring-boot-starter-cache
caffeine
- Install JDK 17
- Download from the official Oracle JDK website
- Install an IDE
- Download and install IntelliJ IDEA or Eclipse
- Configure IDE for Java 17
- Install necessary plugins for Spring Boot development
git clone https://github.com/Sarthakverse/Jwt-Authentication-Authorization-for-SpringBoot-3.3.1.git
Open the cloned folder using STS, IntelliJ Idea or any other IDE, and it will auto download all the configuration files.
http://localhost:8080/
http://localhost:8080/swagger-ui/index.html
Get the postman collection at the following link
https://crimson-flare-571775.postman.co/workspace/Green-Stitch~dcfa712e-5f25-40e2-aedf-60b0e52bcca6/collection/24017701-6dfd191f-0f0c-46c0-a63c-d71dde765b9e?action=share&creator=24017701
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- Email: [email protected]
- GitHub: https://github.com/your-github-profile
- LinkedIn: https://www.linkedin.com/in/sarthak-rastogi-47bb11256//
- Phone: +(91) 8303913426