From 17ca23b645e0688174b917b8d84985c96b0baeb0 Mon Sep 17 00:00:00 2001 From: bw1611 Date: Wed, 14 Feb 2024 23:23:57 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Feat:=20chatroom=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=20apigateway=20=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apigateway-service/src/main/resources/application.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/apigateway-service/src/main/resources/application.yml b/backend/apigateway-service/src/main/resources/application.yml index f705d8e..3f4ef0d 100644 --- a/backend/apigateway-service/src/main/resources/application.yml +++ b/backend/apigateway-service/src/main/resources/application.yml @@ -40,10 +40,10 @@ spring: - Method=GET filters: - AuthFilter - - id: chatting-service # chatting-service - uri: lb://CHATTING-SERVICE + - id: chatroom-service # chatroom-service + uri: lb://CHATROOM-SERVICE predicates: - - Path=/chatting-service/** + - Path=/chatroom-service/** - Method=POST, GET filters: - AuthFilter \ No newline at end of file From 0c980d70c2f19d34d5e3bae4b6a79dd38057f9a7 Mon Sep 17 00:00:00 2001 From: bw1611 Date: Thu, 15 Feb 2024 11:18:19 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Refactoring:=20token=20decoding=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tadak/apigatewayservice/filter/AuthFilter.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/backend/apigateway-service/src/main/java/com/tadak/apigatewayservice/filter/AuthFilter.java b/backend/apigateway-service/src/main/java/com/tadak/apigatewayservice/filter/AuthFilter.java index 3cdc64e..92262d6 100644 --- a/backend/apigateway-service/src/main/java/com/tadak/apigatewayservice/filter/AuthFilter.java +++ b/backend/apigateway-service/src/main/java/com/tadak/apigatewayservice/filter/AuthFilter.java @@ -44,13 +44,11 @@ public GatewayFilter apply(Config config) { return (exchange, chain) -> { ServerHttpRequest request = exchange.getRequest(); - if (request.getHeaders().containsKey(ACCESS_AUTHORIZATION_HEADER)) { - String accessToken = request.getHeaders().get(ACCESS_AUTHORIZATION_HEADER).get(0); + String accessToken = request.getHeaders().get(ACCESS_AUTHORIZATION_HEADER).get(0); + log.info("accessToken = {}", accessToken); - if (isJwtValid(accessToken)) { - log.info("AccessToken 인가받은 사용자입니다."); - return chain.filter(exchange); - } + if (StringUtils.hasText(accessToken) && isJwtValid(accessToken)) { + return chain.filter(exchange); } String refreshToken = request.getHeaders().get(REFRESH_AUTHORIZATION_HEADER).get(0);