Skip to content

Commit

Permalink
Merge pull request #115 from nhnacademy-be5-T3Team/feature/jwtExceptions
Browse files Browse the repository at this point in the history
Feature/jwt exceptions
  • Loading branch information
joohyun1996 authored May 21, 2024
2 parents fd6efa3 + 03cfd9e commit 1d89f58
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
15 changes: 15 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,21 @@
<artifactId>json</artifactId>
<version>20210307</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.11.5</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.11.5</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.11.5</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:/";
}
}
14 changes: 7 additions & 7 deletions src/main/resources/templates/main/page/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ <h5 class="modal-title" id="couponModalLabel">쿠폰을 발급받고 결제창
</div>
<div class="modal-body">

<!-- <form action="/coupons/book" method="post">-->
<!-- <button id = "bookCouponButton" type="submit">도서 쿠폰 발급받기</button>-->
<!-- </form>-->
<!-- <hr>-->
<!-- <form action="/coupons/category" method="post">-->
<!-- <button id = "categoryCouponButton" type="submit">카테고리 쿠폰 발급받기</button>-->
<!-- </form>-->
<!--<form action="/coupons/book" method="post">
<button id = "bookCouponButton" type="submit">도서 쿠폰 발급받기</button>
</form>
<hr>
<form action="/coupons/category" method="post">
<button id = "categoryCouponButton" type="submit">카테고리 쿠폰 발급받기</button>
</form>-->
<button id="bookCouponButton" type="button"
onclick="issueCoupon('/coupons/book', '도서 쿠폰이 발급되었습니다.', '도서 쿠폰 발급에 실패하였습니다. 다시 시도해 주세요.');">
도서 쿠폰 발급받기
Expand Down

0 comments on commit 1d89f58

Please sign in to comment.