You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ol...@apache.org on 2018/05/15 20:18:29 UTC

[ambari] branch trunk updated: AMBARI-23097. Remove '?doAs=' ending from login url.

This is an automated email from the ASF dual-hosted git repository.

oleewere pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 025c18d  AMBARI-23097. Remove '?doAs=' ending from login url.
025c18d is described below

commit 025c18d62e877d70b8b4009d0baba56948965714
Author: Oliver Szabo <ol...@gmail.com>
AuthorDate: Tue May 15 22:16:17 2018 +0200

    AMBARI-23097. Remove '?doAs=' ending from login url.
---
 .../org/apache/ambari/logsearch/auth/filter/AbstractJWTFilter.java     | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/auth/filter/AbstractJWTFilter.java b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/auth/filter/AbstractJWTFilter.java
index ce6eab1..4229fbb 100644
--- a/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/auth/filter/AbstractJWTFilter.java
+++ b/ambari-logsearch/ambari-logsearch-server/src/main/java/org/apache/ambari/logsearch/auth/filter/AbstractJWTFilter.java
@@ -129,6 +129,9 @@ public abstract class AbstractJWTFilter extends AbstractAuthenticationProcessing
     super.unsuccessfulAuthentication(request, response, failed);
     String ajaxRequestHeader = request.getHeader("X-Requested-With");
     String loginUrl = constructLoginURL(request);
+    if (loginUrl.endsWith("?doAs=anonymous")) { // HACK! - use proper solution, investigate which filter changes ? to &
+      loginUrl = StringUtils.removeEnd(loginUrl, "?doAs=anonymous");
+    }
     if (!isWebUserAgent(request.getHeader("User-Agent")) || "XMLHttpRequest".equals(ajaxRequestHeader)) {
       Map<String, String> mapObj = new HashMap<>();
       mapObj.put("knoxssoredirectURL", URLEncoder.encode(loginUrl, "UTF-8"));

-- 
To stop receiving notification emails like this one, please contact
oleewere@apache.org.