【发布时间】:2019-02-01 21:43:17
【问题描述】:
我正在使用 Spring 和 Thymeleaf,我试图在所有页面的标题中显示用户信息(用户名)。
header.html
<div th:fragment="logout" class="logout" sec:authorize="isAuthenticated()">
Logged in user: <span sec:authentication="name"></span> |
Roles: <span sec:authentication="principal.authorities"></span>
<div>
<form action="#" th:action="@{/logout}" method="post">
<input type="submit" value="Logout" />
</form>
</div>
</div>
但它没有显示任何东西
【问题讨论】:
标签: spring spring-boot spring-security thymeleaf