brumi1024 commented on code in PR #8273:
URL: https://github.com/apache/hadoop/pull/8273#discussion_r2853231365
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-web-proxy/src/main/java/org/apache/hadoop/yarn/server/webproxy/ProxyUtils.java:
##########
@@ -122,4 +129,43 @@ public static void rejectNonHttpRequests(ServletRequest
req) throws
throw new ServletException(E_HTTP_HTTPS_ONLY);
}
}
+
+ /**
+ * Returns the value of a cookie with the given name from the HTTP servlet
request.
+ * Cookie name comparison is case-insensitive. If the request contains no
cookies
+ * or the specified cookie is not present, this method returns {@code null}.
+ *
+ * @param req the HTTP servlet request containing cookies
+ * @param cookieName the name of the cookie to retrieve
+ * @return the cookie value, or {@code null} if not found or cookieName is
blank
+ */
+ public static String getCookie(HttpServletRequest req, String cookieName) {
+ Cookie[] cookies = req.getCookies();
+ if (cookies != null && StringUtils.isNotBlank(cookieName)) {
+ for (Cookie cookie : cookies) {
+ if (cookieName.equals(cookie.getName())) {
+ return cookie.getValue();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Sets the {@code Cookie} header on the given HTTP request using the
provided cookies.
+ * Cookies are formatted according to the standard HTTP header syntax:
+ * {@code name=value; name2=value2}.
+ *
+ * @param req the HTTP request on which to set the cookie header
+ * @param cookies a map of cookie names to cookie values
+ */
+ public static void setCookies(HttpRequestBase req, Map<String, String>
cookies) {
+ if (MapUtils.isEmpty(cookies)) {
Review Comment:
Nit: this is an implicit dependency (through hadoop-commons), questionable
if it's worth it. A simple `if (cookies == null || cookies.isEmpty())` should
suffice, without the need of an extra import.
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java:
##########
@@ -2846,6 +2846,10 @@ public static boolean isAclEnabled(Configuration conf) {
public static final int DEFAULT_RM_PROXY_CONNECTION_TIMEOUT =
60000;
+ public static final String RM_PROXY_JWT_FORWARD_ENABLED = RM_PREFIX +
"proxy.jwt-forward.enabled";
+
+ public static final boolean DEFAULT_RM_PROXY_JWT_FORWARD_ENABLED = true;
Review Comment:
I think this should be opt-in rather than opt-out.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]