From 1d8e1d6f7abe70b40524acc7b3593f0340a81dde Mon Sep 17 00:00:00 2001 From: hejin8307 Date: Wed, 8 May 2024 16:14:38 +0900 Subject: [PATCH] Fix: modified token name (#1) --- .../com/hanaro/starbucks/config/JwtAuthenticationFilter.java | 2 -- src/main/java/com/hanaro/starbucks/config/JwtUtil.java | 4 ++-- .../java/com/hanaro/starbucks/controller/OrderController.java | 2 ++ 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/hanaro/starbucks/config/JwtAuthenticationFilter.java b/src/main/java/com/hanaro/starbucks/config/JwtAuthenticationFilter.java index fde581e..c78cc73 100644 --- a/src/main/java/com/hanaro/starbucks/config/JwtAuthenticationFilter.java +++ b/src/main/java/com/hanaro/starbucks/config/JwtAuthenticationFilter.java @@ -5,9 +5,7 @@ import jakarta.servlet.ServletRequest; import jakarta.servlet.ServletResponse; import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.filter.GenericFilterBean; diff --git a/src/main/java/com/hanaro/starbucks/config/JwtUtil.java b/src/main/java/com/hanaro/starbucks/config/JwtUtil.java index 06c91a0..9c7a63d 100644 --- a/src/main/java/com/hanaro/starbucks/config/JwtUtil.java +++ b/src/main/java/com/hanaro/starbucks/config/JwtUtil.java @@ -54,9 +54,9 @@ public Authentication getAuthentication(String token) { ); // 사용자 정보를 기반으로 토큰 생성 } - // http 요청에서 "X-AUTH-TOKEN" 헤더 값을 읽어오는 메소드 + // http 요청에서 "TOKEN" 헤더 값을 읽어오는 메소드 public String resolveToken(HttpServletRequest request) { - return request.getHeader("X-AUTH-TOKEN"); + return request.getHeader("TOKEN"); } public boolean validateToken(String token){ diff --git a/src/main/java/com/hanaro/starbucks/controller/OrderController.java b/src/main/java/com/hanaro/starbucks/controller/OrderController.java index a4ebc5c..3303207 100644 --- a/src/main/java/com/hanaro/starbucks/controller/OrderController.java +++ b/src/main/java/com/hanaro/starbucks/controller/OrderController.java @@ -3,6 +3,7 @@ import com.hanaro.starbucks.dto.orders.OrderEditReqDto; import com.hanaro.starbucks.dto.orders.OrderResDto; import com.hanaro.starbucks.service.OrderService; +import io.jsonwebtoken.Jwts; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; @@ -21,6 +22,7 @@ public class OrderController { public List getOrders() { return orderService.getOrders(); } + @GetMapping("/{orderIdx}") public OrderResDto getOrder(@PathVariable int orderIdx) { return orderService.getOrder(orderIdx);