HADOOP-15681. AuthenticationFilter should generate valid date format for Set-Cookie header regardless of default Locale. Contributed by Cao Manh Dat.

(cherry picked from commit e20b19543ba148cf0242884a3e553ad2f39421b3)
This commit is contained in:
Wei-Chiu Chuang 2019-08-01 17:34:56 -07:00
parent 5c1f91fd97
commit 490b18fd4f

View File

@ -681,7 +681,7 @@ public static void createAuthCookie(HttpServletResponse resp, String token,
if (expires >= 0 && isCookiePersistent) {
Date date = new Date(expires);
SimpleDateFormat df = new SimpleDateFormat("EEE, " +
"dd-MMM-yyyy HH:mm:ss zzz");
"dd-MMM-yyyy HH:mm:ss zzz", Locale.US);
df.setTimeZone(TimeZone.getTimeZone("GMT"));
sb.append("; Expires=").append(df.format(date));
}