I am trying to use the sec: tag to display fields from UserInfo in Spring Boot (3.3.5). I've included the dependency for thymeleaf-extras-springsecurity6 and the xmlns:sec. This works:
<div th:text="${#authentication.getPrincipal().getUserInfo().getFullName()}"></div>
This fails:
<div sec:authentication="principal.userinfo.fullname"></div>
The stack trace tells me that sec:authentication.principal is returning a bean of type OAuth2AuthenticatedPrincipal, while authentication.getPrincipal() is returning a bean of type DefaultOidcUser; the latter has a method getUserInfo, the former does not. I'm guessing that sec:authentication is working from the access token, while thyme leaf is working from the id token. Is there a way to get sec:authentication to produce an id token?