akash-gupta2813 commented on code in PR #1307:
URL: https://github.com/apache/ranger/pull/1307#discussion_r4335668810
##########
security-admin/src/test/java/org/apache/ranger/security/web/filter/TestRangerKrbFilter.java:
##########
@@ -85,6 +85,38 @@ public void testCreateAuthCookieFormatsHeader() {
assertTrue(v.endsWith("; HttpOnly"));
}
+ @Test
+ void testCreateAuthCookieUsesHttpLocaleForExpires() {
+ HttpServletResponse res = mock(HttpServletResponse.class);
+ Locale originalLocale = Locale.getDefault();
+ TimeZone originalTimeZone = TimeZone.getDefault();
+
+ try {
+ Locale.setDefault(Locale.FRANCE);
+ TimeZone.setDefault(TimeZone.getTimeZone("Asia/Tokyo"));
+
+ long expires = 4_093_966_090_000L; // Thu, 24-Sep-2099 20:48:10 GMT
+ RangerKrbFilter.createAuthCookie(res, "token123", "example.com",
"/", expires, true);
+
+ ArgumentCaptor<String> headerValue =
ArgumentCaptor.forClass(String.class);
+ verify(res).addHeader(eq("Set-Cookie"), headerValue.capture());
+
+ String v = headerValue.getValue();
+ assertTrue(v.contains("; Expires=Thu, 24-Sep-2099 20:48:10 GMT"));
+ assertTrue(!v.contains("Sept"));
+ assertTrue(!v.contains("sept."));
Review Comment:
corrected.
--
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]