Skip to content

Commit

Permalink
Merge pull request #106 from Leets-Official/fix/#105/쿠키-수정
Browse files Browse the repository at this point in the history
Refactor #106 쿠키 도메인 설정하도록 수정
  • Loading branch information
hyxklee authored Feb 5, 2025
2 parents 95558f8 + 193e840 commit 4eb0e75
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ public class CookieUtil {
@Value("${gachtaxi.auth.jwt.cookiePathOption}")
private String cookiePathOption;

@Value("${gachtaxi.auth.jwt.cookieDomain}")
private String cookieDomain;

public void setCookie( String name, String value, HttpServletResponse response) {
ResponseCookie cookie = ResponseCookie.from(name, value)
.maxAge(cookieMaxAge)
.path(cookiePathOption)
.secure(secureOption) //https 적용 시 true
.httpOnly(true)
.sameSite("None")
.domain(cookieDomain)
.build();

response.setHeader("Set-Cookie", cookie.toString());
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ gachtaxi:
cookieMaxAge: ${JWT_COOKIE_MAX_AGE}
secureOption: ${COOKIE_SECURE_OPTION}
cookiePathOption: ${COOKIE_PATH_OPTION}
cookieDomain: ${COOKIE_DOMAIN_ADDRESS}
redis:
emailAuthCodeExpiration: ${REDIS_EMAIL_AUTH_CODE_EXPIRATION}
kafka:
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ gachtaxi:
cookieMaxAge: ${JWT_COOKIE_MAX_AGE}
secureOption: ${COOKIE_SECURE_OPTION}
cookiePathOption: ${COOKIE_PATH_OPTION}
cookieDomain: ${COOKIE_DOMAIN_ADDRESS}
redis:
emailAuthCodeExpiration: ${REDIS_EMAIL_AUTH_CODE_EXPIRATION}
kafka:
Expand Down

0 comments on commit 4eb0e75

Please sign in to comment.