Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] DEV와 DEV-BE를 병합한다. #977

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.bang_ggood.auth.service.jwt.JwtTokenProperties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.server.Cookie.SameSite;
import org.springframework.http.ResponseCookie;
import org.springframework.stereotype.Component;
import java.time.Duration;
Expand All @@ -15,14 +14,17 @@ public class CookieProvider {

private final JwtTokenProperties jwtTokenProperties;
private final String domain;
private final String sameSite;
private final String accessTokenPath;
private final String refreshTokenPath;

public CookieProvider(@Value("${domain}") String domain,
@Value("${sameSite}") String sameSite,
@Value("${access-token-path}") String accessTokenPath,
@Value("${refresh-token-path}") String refreshTokenPath,
JwtTokenProperties jwtTokenProperties) {
this.domain = domain;
this.sameSite = sameSite;
this.accessTokenPath = accessTokenPath;
this.refreshTokenPath = refreshTokenPath;
this.jwtTokenProperties = jwtTokenProperties;
Expand Down Expand Up @@ -50,9 +52,9 @@ private ResponseCookie createCookie(String tokenName, String token, long expired
.domain(domain)
.httpOnly(true)
.secure(true)
.sameSite(SameSite.LAX.attributeValue())
.sameSite(sameSite)
.maxAge(Duration.ofMillis(expiredMillis))
.path("/")
.path(path)
.build();
}

Expand All @@ -69,7 +71,7 @@ private ResponseCookie deleteCookie(String tokenName, String path) {
.from(tokenName, "")
.httpOnly(true)
.secure(true)
.sameSite(SameSite.LAX.attributeValue())
.sameSite(sameSite)
.maxAge(0)
.path(path)
.build();
Expand Down
Loading