1. Usage scenarios
Display the logged-in user information in the personal center and other interfaces
2. References
https://blog.csdn.net/gisboygogogo/article/details/78758815
https://my.oschina.net/Cubicluo/blog/831111
3. How to use
3.1 pom
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
</dependency>
3.2 html interface
Note 1:
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
Use: do not fill in the content in the span
<div>账户:<span sec:authentication="name"></span></div>
<div><span sec:authentication="principal.authorities"></span></div>