스프링 시큐리티

Ch03. 실전프로젝트(인증 프로세스 Form 인증 구현) - 로그아웃 및 인증에 따른 화면 보안 처리

webmaster 2022. 1. 19. 10:36
728x90
  • 로그아웃 방법
    • <form> 태그를 사용해서 POST로 요청
    • <a> 태크를 사용해서 GET GET으로 요청  SecurityContextLogoutHandler 활용
  • 인증 여부에 따라 로그인/로그아웃 표현
    • <li sec:authorize="isAnonymous()"><a th:href="@{/login}">로그인</a></li>
    • <li sec:authorize="isAuthenticated()"><a th:href="@{/logout}">로그아웃</a></li>
  • thymeleaf에서 인증 객체가 있고 없고를 판단해줄 수 있다.
 

Thymeleaf + Spring Security integration basics - Thymeleaf

Have you switched to Thymeleaf but your login and error pages are still using JSP? In this article we will see how to configure your Spring application to use Thymeleaf for login and error pages. All the code seen here comes from a working application. You

www.thymeleaf.org

  • Get방식으로 Log아웃을 하기 위해서는 내가 직접 핸들링해주어야 한다.
    • SecurityContextLogoutHandler로 직접 핸들링 한다.

 

 

728x90