⛏️/Spring

[Spring] 로그아웃

defyuil 2023. 12. 29. 09:25

로그아웃

 

security-context

  • invalidate-session="true”: 세션 초기화(쿠키까지도 날릴 수 있음)
  • logout-url="/logout” : 로그아웃 url 불러오면서 세션 날림

 

admin/member

member·admin 에서 만들면됨

 

 

 

CommonsController

 

 

 

views/logout

  • <form action="/customLogout" method="post"> : 시큐리티 내부에서 로그아웃 호출하는 주소

  • commonscontroller에서 get방식으로 로그아웃페이지 호출

logout주소로 post방식으로 처리

 

 

세션 초기화되고 로그인페이지로 이동