ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject ambari git commit: AMBARI-19163. LogSearch - rename JSESSIONID cookie (oleewere)
Date Tue, 13 Dec 2016 11:02:05 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk d3666b3ac -> 3eabb7c27


AMBARI-19163. LogSearch - rename JSESSIONID cookie (oleewere)

Change-Id: I919f1a1caa99874a66185aaa663c0f69ef861bf9


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3eabb7c2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3eabb7c2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3eabb7c2

Branch: refs/heads/trunk
Commit: 3eabb7c27a17fdb5012d87e6a30e53e00be4309d
Parents: d3666b3
Author: oleewere <oleewere@gmail.com>
Authored: Tue Dec 13 11:57:37 2016 +0100
Committer: oleewere <oleewere@gmail.com>
Committed: Tue Dec 13 12:01:29 2016 +0100

----------------------------------------------------------------------
 .../src/main/java/org/apache/ambari/logsearch/LogSearch.java     | 3 +++
 .../org/apache/ambari/logsearch/common/LogSearchConstants.java   | 3 +++
 .../java/org/apache/ambari/logsearch/conf/SecurityConfig.java    | 4 +++-
 .../apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java  | 4 +++-
 4 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3eabb7c2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
index 14f83cf..913d25b 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/LogSearch.java
@@ -56,6 +56,8 @@ import org.springframework.web.filter.DelegatingFilterProxy;
 
 import javax.servlet.DispatcherType;
 
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_SESSION_ID;
+
 public class LogSearch {
   private static final Logger logger = Logger.getLogger(LogSearch.class);
 
@@ -152,6 +154,7 @@ public class LogSearch {
     jerseyServlet.setInitParameter("jersey.config.server.provider.packages","org.apache.ambari.logsearch.rest,io.swagger.jaxrs.listing");
 
     context.getSessionHandler().getSessionManager().setMaxInactiveInterval(SESSION_TIMEOUT);
+    context.getSessionHandler().getSessionManager().getSessionCookieConfig().setName(LOGSEARCH_SESSION_ID);
 
     return context;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3eabb7c2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
index d1fc68d..1e46ae9 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
@@ -20,6 +20,9 @@
 package org.apache.ambari.logsearch.common;
 
 public class LogSearchConstants {
+
+  public static final String LOGSEARCH_SESSION_ID = "LOGSEARCHSESSIONID";
+
   // Log Levels
   public static final String INFO = "INFO";
   public static final String WARN = "WARN";

http://git-wip-us.apache.org/repos/asf/ambari/blob/3eabb7c2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
index 7ffcedd..c99a738 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/conf/SecurityConfig.java
@@ -44,6 +44,8 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
 import javax.inject.Inject;
 import java.util.List;
 
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_SESSION_ID;
+
 @Configuration
 @EnableWebSecurity
 public class SecurityConfig extends WebSecurityConfigurerAdapter {
@@ -77,7 +79,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
       .addFilterBefore(logsearchJwtFilter(), LogsearchSecurityContextFormationFilter.class)
       .logout()
         .logoutUrl("/logout.html")
-        .deleteCookies("JSESSIONID")
+        .deleteCookies(LOGSEARCH_SESSION_ID)
         .logoutSuccessHandler(new LogsearchLogoutSuccessHandler());
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3eabb7c2/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java
index 1af7e74..f4e70d7 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/web/filters/LogsearchKrbFilter.java
@@ -49,6 +49,8 @@ import java.security.Principal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
+import static org.apache.ambari.logsearch.common.LogSearchConstants.LOGSEARCH_SESSION_ID;
+
 @InterfaceAudience.Private
 @InterfaceStability.Unstable
 public class LogsearchKrbFilter implements Filter {
@@ -506,7 +508,7 @@ public class LogsearchKrbFilter implements Filter {
             Collection<String> headerNames = httpResponse.getHeaderNames();
             for(String headerName : headerNames){
                 String value = httpResponse.getHeader(headerName);
-                if(headerName.equalsIgnoreCase("Set-Cookie") && value.startsWith("JSESSIONID")){
+                if(headerName.equalsIgnoreCase("Set-Cookie") && value.startsWith(LOGSEARCH_SESSION_ID)){
                     chk = false;
                     break;
                 }


Mime
View raw message