Skip to content

Commit cae4fee

Browse files
authored
fix: 리뷰 조회에서 isWriter가 항상 false로 나오는 문제 해결 (#225)
* fix: Security Filter Chain 수정 선택적으로 토큰을 받을 수 있돌고 수정 * fix: yml 하드 코딩 제거 --------- Co-authored-by: 나용준 <141994188+youngJun99@users.noreply.github.com>
1 parent 4aecc2d commit cae4fee

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/main/java/ssu/eatssu/domain/auth/security/JwtAuthenticationFilter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
4545
String requestURI = httpRequest.getRequestURI();
4646

4747
if (isWhiteListed(requestURI)) {
48+
String token = resolveToken(httpRequest);
49+
if (token != null && jwtTokenProvider.validateToken(token)) {
50+
Authentication authentication = jwtTokenProvider.getAuthentication(token);
51+
SecurityContextHolder.getContext().setAuthentication(authentication);
52+
}
4853
chain.doFilter(request, response);
4954
return;
5055
}

src/main/resources/application-local.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ server:
66
spring:
77
datasource:
88
driver-class-name: com.mysql.cj.jdbc.Driver
9-
url: jdbc:mysql://eatssu-db.cf0ackgagqzb.ap-northeast-2.rds.amazonaws.com/dev
10-
username: admin
11-
password: ssu2023!
9+
url: ${EATSSU_DB_URL_DEV}
10+
username: ${EATSSU_DB_USERNAME}
11+
password: ${EATSSU_DB_PASSWORD}
1212

1313
jpa:
1414
hibernate:

0 commit comments

Comments
 (0)