README.adoc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. = Form Login + One-Time-Token Login MFA Sample
  2. This sample demonstrates Spring Security's support for multifactor authentication, specifically when using username/password and one-time-token as the two factors.
  3. [[usage]]
  4. == Usage
  5. To use the application, please run:
  6. [source,bash]
  7. ----
  8. ./gradlew :bootRun
  9. ----
  10. You can then navigate to http://localhost:8080 where you will be presented with the default page, showing both the login and ott forms.
  11. You can start with either; once authenticated, you'll be asked to give the other as well.
  12. === Username/Password Login
  13. The username/password is `user/password`.
  14. === One-Time-Token Login
  15. The username is `user`.
  16. After clicking the submission button, you will be redirected to a page where you can enter the code given.
  17. You can find the code in the logs like so:
  18. [source,bash]
  19. ----
  20. ********************************************************
  21. Use this one-time token: 1319c31d-c5e0-4123-9b1f-3ffc34aba673
  22. ********************************************************
  23. ----
  24. == Configuring
  25. There are three profiles in this sample; `default`, `custom-pages`, and `elevated-security`.
  26. `default` is the arrangement described in <<usage>>.
  27. `custom-pages` shows the same, but with a custom page for login and a custom page for one-time-token.
  28. This can be launched with:
  29. [source,bash]
  30. ----
  31. ./gradlew :bootRun --args='spring.profiles.active=custom-pages'
  32. ----
  33. `elevated-security` allows login with either, and will ask for one-time-token login for only the `/profile` page.
  34. This can be launched with:
  35. [source,bash]
  36. ----
  37. ./gradlew :bootRun --args='spring.profiles.active=elevated-security'
  38. ----