Skip to content

Commit 6016e0c

Browse files
ebyhrwendigo
authored andcommittedJan 28, 2024
Replace deprecated NewCookie constructor with builder
1 parent ffa6ecc commit 6016e0c

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed
 

‎gateway-ha/src/main/java/io/trino/gateway/ha/security/SessionCookie.java

+16-6
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,26 @@ private SessionCookie() {}
2525

2626
public static NewCookie getTokenCookie(String token)
2727
{
28-
return new NewCookie(OAUTH_ID_TOKEN,
29-
token, "/", "", "",
30-
60 * 60 * 24, true);
28+
return new NewCookie.Builder(OAUTH_ID_TOKEN)
29+
.value(token)
30+
.path("/")
31+
.domain("")
32+
.comment("")
33+
.maxAge(60 * 60 * 24)
34+
.secure(true)
35+
.build();
3136
}
3237

3338
public static Response logOut()
3439
{
35-
NewCookie cookie = new NewCookie(OAUTH_ID_TOKEN,
36-
"logout", "/", "", "",
37-
0, true);
40+
NewCookie cookie = new NewCookie.Builder(OAUTH_ID_TOKEN)
41+
.value("logout")
42+
.path("/")
43+
.domain("")
44+
.comment("")
45+
.maxAge(0)
46+
.secure(true)
47+
.build();
3848
return Response.ok("You are logged out successfully.")
3949
.cookie(cookie)
4050
.build();

0 commit comments

Comments
 (0)
Please sign in to comment.