From 9ce1031127cd4477901c3ca44d01c692932768d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vill=C5=91=20Sz=C5=B1cs?= Date: Thu, 13 Jun 2024 11:05:49 +0200 Subject: [PATCH] HBASE-28661 Fix compatibility issue in branch-2.x Change-Id: Ia935700ceab37f543faddb1c25d9c1c0c1226c70 --- .../hbase/http/SecurityHeadersFilter.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/SecurityHeadersFilter.java b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/SecurityHeadersFilter.java index 01c8a32c62a0..08e34085a0c8 100644 --- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/SecurityHeadersFilter.java +++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/SecurityHeadersFilter.java @@ -69,10 +69,27 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha public void destroy() { } + /** + * @param conf configuration + * @param isSecure use secure defaults if 'true' + * @return default parameters, as a map + */ public static Map getDefaultParameters(Configuration conf, boolean isSecure) { Map params = new HashMap<>(); params.put("hsts", conf.get("hbase.http.filter.hsts.value", isSecure ? DEFAULT_HSTS : "")); params.put("csp", conf.get("hbase.http.filter.csp.value", isSecure ? DEFAULT_CSP : "")); return params; } + + /** + * @param conf configuration + * @return default parameters, as a map + * @deprecated Use {@link SecurityHeadersFilter#getDefaultParameters(Configuration, boolean)} + * instead. + */ + @Deprecated + public static Map getDefaultParameters(Configuration conf) { + return getDefaultParameters(conf, false); + } + }