hrming
[Thymeleaf] sec:authorize="!isAuthenticated()" 적용 안됨 본문
아래 처럼 로그인을 하지 않은 경우에는 '로그인/회원가입' 메뉴를 보여주고
로그인을 한 경우에는 '로그아웃/마이페이지' 메뉴를 보여주려고 하는데... 모든 메뉴가 계속 보였다. 😣 😣..
<ul class="navbar-nav ms-auto">
<li class="nav-item" sec:authorize="!isAuthenticated()">
<a class="nav-link" href="#" th:href="@{/user/login}">로그인</a>
</li>
<li class="nav-item" sec:authorize="!isAuthenticated()">
<a class="nav-link" href="#" th:href="@{/user/signUp}">회원가입</a>
</li>
<li class="nav-item" sec:authorize="isAuthenticated()">
<form class="logout" id="logoutForm" th:action="@{/logout}" method="post">
<a class="nav-link" href="#" onclick="document.getElementById('logoutForm').submit(); return false;">로그아웃</a>
</form>
</li>
<li class="nav-item" sec:authorize="isAuthenticated()">
<a class="nav-link" href="#" th:href="@{/user/myPage}">마이페이지</a>
</li>
</ul>
확인해보니, Spring boot 3.x.x 버전부터는 thymeleaf-extras-springsecurity5가 아닌 thymeleaf-extras-springsecurity6을 사용해야 한다고 한다..!
참고 및 출처 :
https://velog.io/@yoondoong/Could-not-find-org.thymeleaf.extrasthymeleaf-extras-springsecurity5
Could not find org.thymeleaf.extras:thymeleaf-extras-springsecurity5
Could not find org.thymeleaf.extras:thymeleaf-extras-springsecurity5dependency에 아래와 같이 버전을 같이 명시해주면 됨implementation 'org.thymeleaf.extras:thymeleaf-ex
velog.io
'Thymeleaf' 카테고리의 다른 글
[Thymeleaf] Literal substitutions | (0) | 2024.03.19 |
---|---|
[Thymeleaf] JavaScript에서 Thymeleaf 변수 사용 (0) | 2024.03.16 |
[Thymeleaf] Thymeleaf vs JSP (0) | 2024.02.26 |
Comments