내 마크 업을 사용하여 다음과 같은 방식으로 Spring Boot 애플리케이션의 헤더에있는 버튼을 숨기려고합니다.
<!-- Is not logged in, so don't show "Log In" -->
<li sec:authorize="!isAuthenticated()">
<a href="/login" th:href="@{/login}" class="btn-login">Log In</a>
</li>\
이것이 맞지 않습니까? Thymeleaf 템플릿 엔진을 사용하고 있습니다.
sec
속성이 작동하도록 스프링 부트 앱에 Spring Security Dialect를 추가하십시오 .
@Configuration
public class ThymeleafConfig {
@Bean
public SpringSecurityDialect springSecurityDialect(){
return new SpringSecurityDialect();
}
}
Spring Security Dialect가 있다면 시도해 볼 수 있습니다.
<!-- Show login link only for anonymous users -->
<div sec:authorize="isAnonymous()">
<a href="/login" th:href="@{/login}" class="btn-login">Log In</a>
</div>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다