Skip to content

Commit

Permalink
[Hotfix] - Refresh 토큰으로 재발급 요청시 NullPointException 해결, CORS c…
Browse files Browse the repository at this point in the history
…onfig 빠르게 Cherry pick (#78)

* hotfix: `Refresh` 토큰으로 발급 요청시 `NullPointException` 발생하는 버그 해결

* refactor : cors config 수정

---------

Co-authored-by: kcsc2217 <k12002@nate.com>
  • Loading branch information
jbw9964 and kcsc2217 authored Dec 4, 2024
1 parent 95fd94e commit c894ca8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/palettee/global/configs/CorsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ public CorsConfigurationSource corsConfigurationSource(){
CorsConfiguration config = new CorsConfiguration();

config.setAllowCredentials(true);
config.setAllowedOrigins(List.of("http://localhost:3000", "https://palettee22.netlify.app", "https://palettee.site"));
config.setAllowedOrigins(List.of("http://localhost:3000", "https://palettee22.netlify.app", "https://www.palettee.site"));
config.addAllowedMethod("*");
config.setAllowedHeaders(List.of("*"));
config.setExposedHeaders(List.of("*"));

// 클라이언트에서 접근할 수 있도록 노출할 헤더를 명시
config.setExposedHeaders(List.of("Authorization", "Content-Type", "Cache-Control"));



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ public TokenIssueResponse testIssueToken(
private String getRefreshTokenFromCookie(HttpServletRequest request) {
Cookie[] cookies = request.getCookies();

return Arrays.stream(cookies).parallel()
.filter(cookie -> cookie.getName().equals(REFRESH_TOKEN_COOKIE_KEY))
.map(Cookie::getValue)
.findFirst()
.orElse(null);
return cookies == null ? null :
Arrays.stream(cookies).parallel()
.filter(cookie -> cookie.getName().equals(REFRESH_TOKEN_COOKIE_KEY))
.map(Cookie::getValue)
.findFirst()
.orElse(null);
}


Expand Down

0 comments on commit c894ca8

Please sign in to comment.