November 2017
Intermediate to advanced
542 pages
14h 24m
English
Now that CalendarUser is populated into Spring Security's authentication, we can update our UI to display the name of the current user rather than the email address. Update the header.html file with the following code:
//src/main/resources/templates/fragments/header.html <ul class="nav navbar-nav pull-right" sec:authorize="isAuthenticated()"> <li id="greeting"> <p class="navbar-text">Welcome <div class="navbar-text" th:text="${#authentication.getPrincipal().getName()}"> User</div></p> </li>
Internally, the "${#authentication.getPrincipal().getName()}" tag attribute executes the following code. Observe that the highlighted values correlate to the property attribute of the authentication tag we specified ...
Read now
Unlock full access