From 1178f7cb904354ee8d71b1c3d666043d91d10dbe Mon Sep 17 00:00:00 2001 From: joohyun Date: Tue, 21 May 2024 15:45:59 +0900 Subject: [PATCH] =?UTF-8?q?feature:#160=20=ED=94=84=EB=A1=A0=ED=8A=B8?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20=ED=86=A0=ED=81=B0=20=EC=98=88=EC=99=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 15 +++++++++++++++ .../common/exception/GlobalExceptionHandler.java | 10 ++++++++++ .../resources/templates/main/page/detail.html | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 37851a82..81eaed6e 100644 --- a/pom.xml +++ b/pom.xml @@ -119,6 +119,21 @@ json 20210307 + + io.jsonwebtoken + jjwt-api + 0.11.5 + + + io.jsonwebtoken + jjwt-impl + 0.11.5 + + + io.jsonwebtoken + jjwt-jackson + 0.11.5 + diff --git a/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java b/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java index 02392dd6..be8a2661 100644 --- a/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/t3t/frontserver/common/exception/GlobalExceptionHandler.java @@ -38,4 +38,14 @@ public String handleLogoutException(Model model, FeignException.Unauthorized e, response.addCookie(cookie); return "redirect:/login"; } + + @ExceptionHandler(FeignException.class) + public String handleJ2WTException(Model model, FeignException e, HttpServletResponse response){ + Cookie cookie = new Cookie("t3t", null); + cookie.setMaxAge(0); + cookie.setPath("/"); + SecurityContextHolder.clearContext(); + response.addCookie(cookie); + return "redirect:/"; + } } diff --git a/src/main/resources/templates/main/page/detail.html b/src/main/resources/templates/main/page/detail.html index 87aa9006..3ada0d9e 100644 --- a/src/main/resources/templates/main/page/detail.html +++ b/src/main/resources/templates/main/page/detail.html @@ -154,7 +154,7 @@