index.html 1.1 KB

123456789101112131415161718192021222324
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org" xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
  3. <head>
  4. <title>Hello Spring Security</title>
  5. <meta charset="utf-8" />
  6. <link rel="stylesheet" href="/static/css/main.css" th:href="@{/css/main.css}" />
  7. </head>
  8. <body>
  9. <div th:fragment="logout" class="logout" sec:authorize="isAuthenticated()">
  10. Logged in user: <span sec:authentication="name"></span> |
  11. Roles: <span sec:authentication="principal.authorities"></span>
  12. <div>
  13. <form action="#" th:action="@{/logout}" method="post">
  14. <input type="submit" value="Logout" />
  15. </form>
  16. </div>
  17. </div>
  18. <h1>Hello Spring Security</h1>
  19. <p>This is an unsecured page, but you can access the secured pages after authenticating.</p>
  20. <ul>
  21. <li>Go to the <a href="/user/index" th:href="@{/user/index}">secured pages</a></li>
  22. </ul>
  23. </body>
  24. </html>