November 2017
Intermediate to advanced
542 pages
14h 24m
English
In this section, we will demonstrate how we can use Java-based code to determine if we should render some content. We can choose to only show the Create Event link on the Welcome page to users who have a username that contains user. This will hide the Create Event link on the Welcome page from users who are not logged in as administrators.
The welcome controller from the sample code for this chapter has been updated to populate the model with an attribute named showCreateLink, derived from the method name, as follows:
//src/main/java/com/packtpub/springsecurity/web/controllers/WelcomeController.java @ModelAttribute (“showCreateLink”) public boolean showCreateLink(Authentication authentication) ...
Read now
Unlock full access