I have a Spring Boot application that uses Spring Security and Thymeleaf template. I am trying to display the logged-in user\'s first name and last name in a template when t
For thymleaf 4 and above you have to modify some classes in order to get the info. Heres how you can do that:
First, add the getter of your user getUser(){return this.user;}
in the UserDetails class and then push that object in the UserDetailsService object. Without these changes, thymleaf will not parse your HTML file.
Then you can get the info as follows: