From 2ed839f67d85b286f7e9be33d28b18cc3e2e1bb2 Mon Sep 17 00:00:00 2001 From: Vikash Kumar Date: Tue, 24 Sep 2024 11:57:11 +0530 Subject: [PATCH] Use upper bounded wildcard to read and delete cookie --- .../src/main/java/io/trino/server/ui/MultipartUiCookie.java | 4 ++-- .../src/main/java/io/trino/server/ui/OAuthIdTokenCookie.java | 4 ++-- .../src/main/java/io/trino/server/ui/OAuthWebUiCookie.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/server/ui/MultipartUiCookie.java b/core/trino-main/src/main/java/io/trino/server/ui/MultipartUiCookie.java index cce7a0ba18003..bb1f59550a795 100644 --- a/core/trino-main/src/main/java/io/trino/server/ui/MultipartUiCookie.java +++ b/core/trino-main/src/main/java/io/trino/server/ui/MultipartUiCookie.java @@ -63,7 +63,7 @@ public NewCookie[] create(String token, Instant tokenExpiration, boolean isSecur return cookiesToSet.build().toArray(new NewCookie[0]); } - public Optional read(Map existingCookies) + public Optional read(Map existingCookies) { long cookiesCount = existingCookies.values().stream() .filter(this::matchesName) @@ -85,7 +85,7 @@ public Optional read(Map existingCookies) return Optional.of(token.toString()); } - public NewCookie[] delete(Map existingCookies, boolean isSecured) + public NewCookie[] delete(Map existingCookies, boolean isSecured) { ImmutableSet.Builder cookiesToDelete = ImmutableSet.builder(); cookiesToDelete.add(deleteCookie(cookieName, isSecured)); // Always invalidate first cookie even if it doesn't exist diff --git a/core/trino-main/src/main/java/io/trino/server/ui/OAuthIdTokenCookie.java b/core/trino-main/src/main/java/io/trino/server/ui/OAuthIdTokenCookie.java index e5acab68f3ea0..e4c20001e9559 100644 --- a/core/trino-main/src/main/java/io/trino/server/ui/OAuthIdTokenCookie.java +++ b/core/trino-main/src/main/java/io/trino/server/ui/OAuthIdTokenCookie.java @@ -35,12 +35,12 @@ public static NewCookie[] create(String token, Instant tokenExpiration) return MULTIPART_COOKIE.create(token, tokenExpiration, true); } - public static Optional read(Map availableCookies) + public static Optional read(Map availableCookies) { return MULTIPART_COOKIE.read(availableCookies); } - public static NewCookie[] delete(Map availableCookies) + public static NewCookie[] delete(Map availableCookies) { return MULTIPART_COOKIE.delete(availableCookies, true); } diff --git a/core/trino-main/src/main/java/io/trino/server/ui/OAuthWebUiCookie.java b/core/trino-main/src/main/java/io/trino/server/ui/OAuthWebUiCookie.java index f57d8fe5eb9ea..733bb7d4f5726 100644 --- a/core/trino-main/src/main/java/io/trino/server/ui/OAuthWebUiCookie.java +++ b/core/trino-main/src/main/java/io/trino/server/ui/OAuthWebUiCookie.java @@ -35,12 +35,12 @@ public static NewCookie[] create(String token, Instant tokenExpiration) return MULTIPART_COOKIE.create(token, tokenExpiration, true); } - public static Optional read(Map availableCookies) + public static Optional read(Map availableCookies) { return MULTIPART_COOKIE.read(availableCookies); } - public static NewCookie[] delete(Map availableCookies) + public static NewCookie[] delete(Map availableCookies) { return MULTIPART_COOKIE.delete(availableCookies, true); }