From 60225b1b6e781f975f3ddbb8c6eb7ce8efce28d8 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 in OAuthWebUiCookie --- .../src/main/java/io/trino/server/ui/MultipartUiCookie.java | 4 ++-- .../src/main/java/io/trino/server/ui/OAuthWebUiCookie.java | 4 ++-- 2 files changed, 4 insertions(+), 4 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 cce7a0ba18003d..bb1f59550a795a 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/OAuthWebUiCookie.java b/core/trino-main/src/main/java/io/trino/server/ui/OAuthWebUiCookie.java index f57d8fe5eb9eaa..733bb7d4f57266 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); }