Search code examples
springspring-securitythymeleaf

How to hide then logout link using spring security


I'm working with spring security and thymeleaf ,i want to hide the logout link if user is not authenticated and i don't know how to do that. Could anyone please help me? Thanks.


Solution

  • Enclose your page content (what you want to hide) in this (sec:authorize="isAuthenticated()") tag, like below:

    <div sec:authorize="isAuthenticated()">
    < Hide your stuff here >
    </div>