This is a simple project that demonstrats the Two Factor Authentication in the Micronaut. The security code is a customization from the Security-JWT generated code in MicrostarterCli tool.
- The application is a Micronaut application that stores the users-details and refresh-token in H2 database.
- The application creates an admin user on startup event with password "admin".
- Login URL: http://localhost:8080/api/users/login , Method: POST, Request Body: {"username":admin, "password":"admin"}.
- On success login trial, the application will log the OTP on the console to simulate sending email or SMS. Please check OTPService.java.
- The new OTP is valid for 5 Minutes.
- Verify URL: http://localhost:8080/api/users/verify, Method: POST, Request Body: {"username":"admin", "password":}.
- The response of the verification is the JWT token.
> gradlew run
Happy Coding :)