index.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!--
  2. ~ Copyright 2002-2019 the original author or authors.
  3. ~
  4. ~ Licensed under the Apache License, Version 2.0 (the "License");
  5. ~ you may not use this file except in compliance with the License.
  6. ~ You may obtain a copy of the License at
  7. ~
  8. ~ https://www.apache.org/licenses/LICENSE-2.0
  9. ~
  10. ~ Unless required by applicable law or agreed to in writing, software
  11. ~ distributed under the License is distributed on an "AS IS" BASIS,
  12. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. ~ See the License for the specific language governing permissions and
  14. ~ limitations under the License.
  15. -->
  16. <!DOCTYPE html>
  17. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="https://www.thymeleaf.org" xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
  18. <head>
  19. <title>Hello Spring Security</title>
  20. <meta charset="utf-8" />
  21. <link rel="stylesheet" href="/static/css/main.css" th:href="@{/css/main.css}" />
  22. </head>
  23. <body>
  24. <div th:fragment="logout" class="logout" sec:authorize="isAuthenticated()">
  25. Logged in user: <span sec:authentication="name"></span> |
  26. Roles: <span sec:authentication="principal.authorities"></span>
  27. <div>
  28. <form action="#" th:action="@{/logout}" method="post">
  29. <input type="submit" value="Logout" />
  30. </form>
  31. </div>
  32. </div>
  33. <h1>Hello Spring Security</h1>
  34. <p>This is an unsecured page, but you can access the secured pages after authenticating.</p>
  35. <ul>
  36. <li>Go to the <a href="/user/index" th:href="@{/user/index}">secured pages</a></li>
  37. </ul>
  38. </body>
  39. </html>