README.adoc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. === Time-sensitive Endpoints
  25. Navigating to `/profile` is authorized if you have entered your password within the last five minutes.
  26. Otherwise, you are directed back to the login page.
  27. == Configuring
  28. There are two profiles in this sample: `default` and `custom-pages`.
  29. `default` is the arrangement described in <<usage>>.
  30. `custom-pages` shows the same, but with a custom page for login and a custom page for one-time-token.
  31. This can be launched with:
  32. [source,bash]
  33. ----
  34. ./gradlew :bootRun --args='spring.profiles.active=custom-pages'
  35. ----
  36. `elevated-security` allows login with either, and will ask for one-time-token login for only the `/profile` page.
  37. This can be launched with:
  38. [source,bash]
  39. ----
  40. ./gradlew :bootRun --args='spring.profiles.active=elevated-security'
  41. ----