Skip to content

Commit

Permalink
feat: 쿠키 수정사항 롤백
Browse files Browse the repository at this point in the history
  • Loading branch information
f1v3-dev committed Sep 4, 2024
1 parent 61403b1 commit cfc79b2
Showing 1 changed file with 0 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

/**
* OAuth 로그인 성공시 JWT 토큰(AT, RT)을 생성하고 쿠키에 저장합니다.
Expand Down Expand Up @@ -59,31 +57,12 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo
*/
private ResponseCookie createCookie(String name, String value, int maxAge) {

String domain = extractDomain(jjakkakProperties.getFrontUrl());

return ResponseCookie.from(name, value)
.secure(true)
.sameSite("None")
.httpOnly(true)
.path("/")
.maxAge(maxAge)
.domain(domain)
.build();
}

/**
* URL에서 도메인을 추출하는 메서드입니다.
*
* @param url URL (FRONT URL)
* @return 도메인
*/
private String extractDomain(String url) {
try {
URL parsedUrl = new URL(url);
return parsedUrl.getHost();
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Invalid URL: " + url, e);
}
}

}

0 comments on commit cfc79b2

Please sign in to comment.