Repository: nifi
Updated Branches:
  refs/heads/master 684f41740 -> e10b4beb9


NIFI-2797: - Correcting download URIs for OTPs.

This closes #1038.

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


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

Branch: refs/heads/master
Commit: e10b4beb9062c65e86a19ae16b6636768ac29bde
Parents: 684f417
Author: Matt Gilman <matt.c.gil...@gmail.com>
Authored: Tue Sep 20 12:50:55 2016 -0400
Committer: Bryan Bende <bbe...@apache.org>
Committed: Wed Sep 21 10:33:39 2016 -0400

----------------------------------------------------------------------
 .../nifi/web/security/otp/OtpAuthenticationFilter.java    |  6 +++---
 .../web/security/otp/OtpAuthenticationFilterTest.java     | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/e10b4beb/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/otp/OtpAuthenticationFilter.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/otp/OtpAuthenticationFilter.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/otp/OtpAuthenticationFilter.java
index 1ab0b41..34883fc 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/otp/OtpAuthenticationFilter.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/otp/OtpAuthenticationFilter.java
@@ -31,11 +31,11 @@ public class OtpAuthenticationFilter extends 
NiFiAuthenticationFilter {
     private static final Logger logger = 
LoggerFactory.getLogger(OtpAuthenticationFilter.class);
 
     private static final Pattern PROVENANCE_DOWNLOAD_PATTERN =
-        
Pattern.compile("/controller/provenance/events/[0-9]+/content/(?:(?:output)|(?:input))");
+        
Pattern.compile("/provenance-events/([0-9]+)/content/((?:input)|(?:output))");
     private static final Pattern QUEUE_DOWNLOAD_PATTERN =
-        
Pattern.compile("/controller/process-groups/(?:(?:root)|(?:[a-f0-9\\-]{36}))/connections/[a-f0-9\\-]{36}/flowfiles/[a-f0-9\\-]{36}/content");
+        
Pattern.compile("/flowfile-queues/([a-f0-9\\-]{36})/flowfiles/([a-f0-9\\-]{36})/content");
     private static final Pattern TEMPLATE_DOWNLOAD_PATTERN =
-        Pattern.compile("/controller/templates/[a-f0-9\\-]{36}");
+        Pattern.compile("/templates/[a-f0-9\\-]{36}/download");
 
     protected static final String ACCESS_TOKEN = "access_token";
 

http://git-wip-us.apache.org/repos/asf/nifi/blob/e10b4beb/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/otp/OtpAuthenticationFilterTest.java
----------------------------------------------------------------------
diff --git 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/otp/OtpAuthenticationFilterTest.java
 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/otp/OtpAuthenticationFilterTest.java
index 791ca54..8027b8f 100644
--- 
a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/otp/OtpAuthenticationFilterTest.java
+++ 
b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/otp/OtpAuthenticationFilterTest.java
@@ -65,7 +65,7 @@ public class OtpAuthenticationFilterTest {
         when(request.isSecure()).thenReturn(true);
         
when(request.getParameter(OtpAuthenticationFilter.ACCESS_TOKEN)).thenReturn("my-access-token");
         when(request.getContextPath()).thenReturn("/nifi-api");
-        when(request.getPathInfo()).thenReturn("/controller/config");
+        when(request.getPathInfo()).thenReturn("/flow/cluster/summary");
 
         assertNull(otpAuthenticationFilter.attemptAuthentication(request));
     }
@@ -88,7 +88,7 @@ public class OtpAuthenticationFilterTest {
         when(request.isSecure()).thenReturn(true);
         
when(request.getParameter(OtpAuthenticationFilter.ACCESS_TOKEN)).thenReturn(DOWNLOAD_TOKEN);
         when(request.getContextPath()).thenReturn("/nifi-api");
-        
when(request.getPathInfo()).thenReturn("/controller/provenance/events/0/content/input");
+        
when(request.getPathInfo()).thenReturn("/provenance-events/0/content/input");
 
         final OtpAuthenticationRequestToken result = 
(OtpAuthenticationRequestToken) 
otpAuthenticationFilter.attemptAuthentication(request);
         assertEquals(DOWNLOAD_TOKEN, result.getToken());
@@ -101,7 +101,7 @@ public class OtpAuthenticationFilterTest {
         when(request.isSecure()).thenReturn(true);
         
when(request.getParameter(OtpAuthenticationFilter.ACCESS_TOKEN)).thenReturn(DOWNLOAD_TOKEN);
         when(request.getContextPath()).thenReturn("/nifi-api");
-        
when(request.getPathInfo()).thenReturn("/controller/provenance/events/0/content/output");
+        
when(request.getPathInfo()).thenReturn("/provenance-events/0/content/output");
 
         final OtpAuthenticationRequestToken result = 
(OtpAuthenticationRequestToken) 
otpAuthenticationFilter.attemptAuthentication(request);
         assertEquals(DOWNLOAD_TOKEN, result.getToken());
@@ -116,7 +116,7 @@ public class OtpAuthenticationFilterTest {
         when(request.isSecure()).thenReturn(true);
         
when(request.getParameter(OtpAuthenticationFilter.ACCESS_TOKEN)).thenReturn(DOWNLOAD_TOKEN);
         when(request.getContextPath()).thenReturn("/nifi-api");
-        
when(request.getPathInfo()).thenReturn(String.format("/controller/process-groups/root/connections/%s/flowfiles/%s/content",
 uuid, uuid));
+        
when(request.getPathInfo()).thenReturn(String.format("/flowfile-queues/%s/flowfiles/%s/content",
 uuid, uuid));
 
         final OtpAuthenticationRequestToken result = 
(OtpAuthenticationRequestToken) 
otpAuthenticationFilter.attemptAuthentication(request);
         assertEquals(DOWNLOAD_TOKEN, result.getToken());
@@ -131,7 +131,7 @@ public class OtpAuthenticationFilterTest {
         when(request.isSecure()).thenReturn(true);
         
when(request.getParameter(OtpAuthenticationFilter.ACCESS_TOKEN)).thenReturn(DOWNLOAD_TOKEN);
         when(request.getContextPath()).thenReturn("/nifi-api");
-        
when(request.getPathInfo()).thenReturn(String.format("/controller/templates/%s",
 uuid));
+        
when(request.getPathInfo()).thenReturn(String.format("/templates/%s/download", 
uuid));
 
         final OtpAuthenticationRequestToken result = 
(OtpAuthenticationRequestToken) 
otpAuthenticationFilter.attemptAuthentication(request);
         assertEquals(DOWNLOAD_TOKEN, result.getToken());

Reply via email to