👀오류내용
다음은 로그인을 확인하여 로그인 또는 로그아웃을 보여줘야하는데 둘다 보임
<li class="nav-item">
<a class="nav-link" sec:authorize="isAnonymous()" th:href="@{/user/login}">로그인</a>
<a class="nav-link" sec:authorize="isAuthenticated()" th:href="@{/user/logout}">로그아웃</a>
</li>
🔍오류원인
sec:authorize가 작동하지않는것으로 보임
현재 thymeleaf, Security 의존성은 다음과같이 추가되어있었음.
이 의존성에서는 작동하지않는것을 확인
<!-- thymeleaf layout -->
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
🎁오류 해결법
sec:authorize을 작동시키기 위한 의존성을 찾았고 추가하였음
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity6</artifactId>
<version>3.1.0.M1</version>
</dependency>
🎇오류해결
sec:authorize이 정상작동하기 시작했다.
'Computer Science > 오류해결' 카테고리의 다른 글
[오류][Node.js] gh-pages githubpages 배포 오류 (0) | 2024.07.05 |
---|---|
[오류][django] referenced before assignment (0) | 2024.05.14 |
[오류] github pages 상대 경로, 절대경로로 인한 오류 (0) | 2024.05.13 |