You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by bb...@apache.org on 2018/06/12 16:50:57 UTC

nifi git commit: NIFI-5237: - Ensuring the proxy headers are considered when redirecting the user following a OIDC or Knox login exchange.

Repository: nifi
Updated Branches:
  refs/heads/master 09f926003 -> 8feac9ae5


NIFI-5237:
- Ensuring the proxy headers are considered when redirecting the user following a OIDC or Knox login exchange.

This closes #2763.

Signed-off-by: Bryan Bende <bb...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/8feac9ae
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/8feac9ae
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/8feac9ae

Branch: refs/heads/master
Commit: 8feac9ae54f84fbc86f957732e193e91726ea785
Parents: 09f9260
Author: Matt Gilman <ma...@gmail.com>
Authored: Tue Jun 5 12:47:36 2018 -0400
Committer: Bryan Bende <bb...@apache.org>
Committed: Tue Jun 12 12:50:37 2018 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/nifi/web/api/AccessResource.java | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/8feac9ae/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java
index ddb4dce..c1c93a1 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessResource.java
@@ -266,7 +266,7 @@ public class AccessResource extends ApplicationResource {
             }
 
             // redirect to the name page
-            httpServletResponse.sendRedirect("../../../nifi");
+            httpServletResponse.sendRedirect(getNiFiUri());
         } else {
             // remove the oidc request cookie
             removeOidcRequestCookie(httpServletResponse);
@@ -369,7 +369,7 @@ public class AccessResource extends ApplicationResource {
             return;
         }
 
-        httpServletResponse.sendRedirect("../../../nifi");
+        httpServletResponse.sendRedirect(getNiFiUri());
     }
 
     /**
@@ -740,6 +740,12 @@ public class AccessResource extends ApplicationResource {
         return generateResourceUri("access", "oidc", "callback");
     }
 
+    private String getNiFiUri() {
+        final String nifiApiUrl = generateResourceUri();
+        final String baseUrl = StringUtils.substringBeforeLast(nifiApiUrl,"/nifi-api");
+        return baseUrl + "/nifi";
+    }
+
     private void removeOidcRequestCookie(final HttpServletResponse httpServletResponse) {
         final Cookie cookie = new Cookie(OIDC_REQUEST_IDENTIFIER, null);
         cookie.setPath("/");