How can I display the current logged in User with Spring Boot Thymeleaf?

后端 未结 4 654
故里飘歌
故里飘歌 2021-01-18 19:18

I am trying to display the details of the current user however I keep getting errors. I tried accessing the authenticated user from the template but that did not work as I w

4条回答
  •  生来不讨喜
    2021-01-18 19:54

    Reference (4. Spring Security Dialect):

    https://www.thymeleaf.org/doc/articles/springsecurity.html

    Add dependencies pom.xml

    
            org.thymeleaf.extras
            thymeleaf-extras-springsecurity4
    
    

    and the view (Thymeleaf):

    Authenticated user roles: Logged user: | Roles:

    I hope you serve them

提交回复
热议问题