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 1ab0b41294..34883fc62f 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"; 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 791ca54b04..8027b8fb27 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());