From 4e869e661dcb4af01160f0e14522f4f41e8c7b25 Mon Sep 17 00:00:00 2001 From: Pierre Villard Date: Mon, 18 Nov 2024 15:31:55 +0100 Subject: [PATCH] NIFI-14021 Upgraded Spring to 6.2.0 and other dependencies - Azure BOM from 1.2.28 to 1.2.29 - MSAL4J from 1.17.1 to 1.17.2 - GCP BOM from 26.49.0 to 26.50.0 - AWS SDK v1 from 1.12.777 to 1.12.778 - AWS SDK v2 from 2.29.1 to 2.29.15 - Groovy from 4.0.23 to 4.0.24 - Spring Framework from 6.1.14 to 6.2.0 - Swagger annotation from 2.2.25 to 2.2.26 - Set HTTPS port values for OAuth2 Request Resolver Test - Removed invalid Autowired annotations from Web Config - Set required to false for Autowired cluster components This closes #9531 Signed-off-by: David Handermann Co-authored-by: David Handermann Co-authored-by: Pierre Villard --- nifi-extension-bundles/nifi-azure-bundle/pom.xml | 4 ++-- nifi-extension-bundles/nifi-gcp-bundle/pom.xml | 2 +- .../org/apache/nifi/web/NiFiWebApiConfiguration.java | 3 --- .../apache/nifi/web/StandardNiFiServiceFacade.java | 2 +- .../org/apache/nifi/web/api/AccessPolicyResource.java | 11 +++++++++-- .../org/apache/nifi/web/api/ApplicationResource.java | 4 ++-- .../apache/nifi/web/api/AuthenticationResource.java | 7 ++++--- .../org/apache/nifi/web/api/SiteToSiteResource.java | 2 +- .../java/org/apache/nifi/web/api/TenantsResource.java | 11 +++++++++-- ...tandardOAuth2AuthorizationRequestResolverTest.java | 10 ++++++---- pom.xml | 10 +++++----- 11 files changed, 40 insertions(+), 26 deletions(-) diff --git a/nifi-extension-bundles/nifi-azure-bundle/pom.xml b/nifi-extension-bundles/nifi-azure-bundle/pom.xml index 40690fd84d..43a3cba2ab 100644 --- a/nifi-extension-bundles/nifi-azure-bundle/pom.xml +++ b/nifi-extension-bundles/nifi-azure-bundle/pom.xml @@ -28,8 +28,8 @@ - 1.2.28 - 1.17.1 + 1.2.29 + 1.17.2 0.34.1 diff --git a/nifi-extension-bundles/nifi-gcp-bundle/pom.xml b/nifi-extension-bundles/nifi-gcp-bundle/pom.xml index 7a270fa361..2a458673cd 100644 --- a/nifi-extension-bundles/nifi-gcp-bundle/pom.xml +++ b/nifi-extension-bundles/nifi-gcp-bundle/pom.xml @@ -25,7 +25,7 @@ pom - 26.49.0 + 26.50.0 diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiWebApiConfiguration.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiWebApiConfiguration.java index f5617b6b07..d5c8bb9376 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiWebApiConfiguration.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiWebApiConfiguration.java @@ -23,7 +23,6 @@ import org.apache.nifi.util.NiFiProperties; import org.apache.nifi.web.configuration.AuthenticationConfiguration; import org.apache.nifi.web.configuration.WebApplicationConfiguration; import org.apache.nifi.web.security.configuration.WebSecurityConfiguration; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -71,14 +70,12 @@ public class NiFiWebApiConfiguration { * @param properties NiFi Properties * @return Audit Service implementation using Persistent Entity Store */ - @Autowired @Bean public AuditService auditService(final NiFiProperties properties) { final File databaseDirectory = properties.getDatabaseRepositoryPath().toFile(); return new EntityStoreAuditService(databaseDirectory); } - @Autowired @Bean public AuthenticationConfiguration authenticationConfiguration(final NiFiProperties properties) { final URI loginUri; diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java index fed8e798b0..49385a9ca8 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java @@ -7094,7 +7094,7 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { this.clusterCoordinator = coordinator; } - @Autowired + @Autowired(required = false) public void setHeartbeatMonitor(final HeartbeatMonitor heartbeatMonitor) { this.heartbeatMonitor = heartbeatMonitor; } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java index 36e70c8f53..9d468ac646 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AccessPolicyResource.java @@ -57,6 +57,7 @@ import org.apache.nifi.web.api.entity.AccessPolicyEntity; import org.apache.nifi.web.api.request.ClientIdParameter; import org.apache.nifi.web.api.request.LongParameter; import org.apache.nifi.web.dao.AccessPolicyDAO; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; /** @@ -70,8 +71,14 @@ public class AccessPolicyResource extends ApplicationResource { private final NiFiServiceFacade serviceFacade; private final Authorizer authorizer; - public AccessPolicyResource(NiFiServiceFacade serviceFacade, Authorizer authorizer, NiFiProperties properties, RequestReplicator requestReplicator, - ClusterCoordinator clusterCoordinator, FlowController flowController) { + public AccessPolicyResource( + NiFiServiceFacade serviceFacade, + Authorizer authorizer, + NiFiProperties properties, + @Autowired(required = false) final RequestReplicator requestReplicator, + @Autowired(required = false) ClusterCoordinator clusterCoordinator, + @Autowired(required = false) FlowController flowController + ) { this.serviceFacade = serviceFacade; this.authorizer = authorizer; setProperties(properties); diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java index 759eecc92b..0e0164aa5e 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java @@ -1055,7 +1055,7 @@ public abstract class ApplicationResource { } } - @Autowired + @Autowired(required = false) public void setRequestReplicator(final RequestReplicator requestReplicator) { this.requestReplicator = requestReplicator; } @@ -1071,7 +1071,7 @@ public abstract class ApplicationResource { this.properties = properties; } - @Autowired + @Autowired(required = false) public void setClusterCoordinator(final ClusterCoordinator clusterCoordinator) { this.clusterCoordinator = clusterCoordinator; } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AuthenticationResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AuthenticationResource.java index d3c60275af..fc40377964 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AuthenticationResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/AuthenticationResource.java @@ -35,6 +35,7 @@ import org.apache.nifi.web.api.dto.AuthenticationConfigurationDTO; import org.apache.nifi.web.api.entity.AuthenticationConfigurationEntity; import org.apache.nifi.web.configuration.AuthenticationConfiguration; import org.apache.nifi.web.servlet.shared.RequestUriBuilder; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; @@ -50,9 +51,9 @@ public class AuthenticationResource extends ApplicationResource { public AuthenticationResource( final AuthenticationConfiguration authenticationConfiguration, final NiFiProperties properties, - final RequestReplicator requestReplicator, - final ClusterCoordinator clusterCoordinator, - final FlowController flowController + @Autowired(required = false) final RequestReplicator requestReplicator, + @Autowired(required = false) final ClusterCoordinator clusterCoordinator, + @Autowired(required = false) final FlowController flowController ) { this.authenticationConfiguration = Objects.requireNonNull(authenticationConfiguration); setProperties(properties); diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SiteToSiteResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SiteToSiteResource.java index b3acee8a87..bae9c6df72 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SiteToSiteResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/SiteToSiteResource.java @@ -317,7 +317,7 @@ public class SiteToSiteResource extends ApplicationResource { this.authorizer = authorizer; } - @Autowired + @Autowired(required = false) @Override public void setClusterCoordinator(final ClusterCoordinator clusterCoordinator) { super.setClusterCoordinator(clusterCoordinator); diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java index 8b67ef4746..ad848ff891 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/TenantsResource.java @@ -64,6 +64,7 @@ import org.apache.nifi.web.api.entity.UsersEntity; import org.apache.nifi.web.api.request.ClientIdParameter; import org.apache.nifi.web.api.request.LongParameter; import org.apache.nifi.web.dao.AccessPolicyDAO; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @Controller @@ -74,8 +75,14 @@ public class TenantsResource extends ApplicationResource { private final NiFiServiceFacade serviceFacade; private final Authorizer authorizer; - public TenantsResource(NiFiServiceFacade serviceFacade, Authorizer authorizer, NiFiProperties properties, RequestReplicator requestReplicator, - ClusterCoordinator clusterCoordinator, FlowController flowController) { + public TenantsResource( + NiFiServiceFacade serviceFacade, + Authorizer authorizer, + NiFiProperties properties, + @Autowired(required = false) final RequestReplicator requestReplicator, + @Autowired(required = false) final ClusterCoordinator clusterCoordinator, + @Autowired(required = false) final FlowController flowController + ) { this.serviceFacade = serviceFacade; this.authorizer = authorizer; setProperties(properties); diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/oidc/client/web/StandardOAuth2AuthorizationRequestResolverTest.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/oidc/client/web/StandardOAuth2AuthorizationRequestResolverTest.java index e75f0e9a16..114e0d3272 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/oidc/client/web/StandardOAuth2AuthorizationRequestResolverTest.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/test/java/org/apache/nifi/web/security/oidc/client/web/StandardOAuth2AuthorizationRequestResolverTest.java @@ -46,9 +46,11 @@ import static org.mockito.Mockito.when; class StandardOAuth2AuthorizationRequestResolverTest { private static final String REDIRECT_URI = "https://localhost:8443/nifi-api/callback"; + private static final int FORWARDED_HTTPS_PORT = 443; + private static final String FORWARDED_PATH = "/forwarded"; - private static final String FORWARDED_REDIRECT_URI = String.format("https://localhost.localdomain%s/nifi-api/callback", FORWARDED_PATH); + private static final String FORWARDED_REDIRECT_URI = String.format("https://localhost.localdomain:%d%s/nifi-api/callback", FORWARDED_HTTPS_PORT, FORWARDED_PATH); private static final String ALLOWED_CONTEXT_PATHS_PARAMETER = "allowedContextPaths"; @@ -60,7 +62,7 @@ class StandardOAuth2AuthorizationRequestResolverTest { private static final String REGISTRATION_ID = OidcRegistrationProperty.REGISTRATION_ID.getProperty(); - private static final int UNSPECIFIED_PORT = -1; + private static final int STANDARD_SERVER_PORT = 8443; MockHttpServletRequest httpServletRequest; @@ -117,10 +119,10 @@ class StandardOAuth2AuthorizationRequestResolverTest { servletContext.setInitParameter(ALLOWED_CONTEXT_PATHS_PARAMETER, FORWARDED_PATH); final URI forwardedRedirectUri = URI.create(FORWARDED_REDIRECT_URI); - httpServletRequest.setServerPort(UNSPECIFIED_PORT); + httpServletRequest.setServerPort(STANDARD_SERVER_PORT); httpServletRequest.addHeader(ProxyHeader.PROXY_SCHEME.getHeader(), forwardedRedirectUri.getScheme()); httpServletRequest.addHeader(ProxyHeader.PROXY_HOST.getHeader(), forwardedRedirectUri.getHost()); - httpServletRequest.addHeader(ProxyHeader.PROXY_PORT.getHeader(), forwardedRedirectUri.getPort()); + httpServletRequest.addHeader(ProxyHeader.PROXY_PORT.getHeader(), FORWARDED_HTTPS_PORT); httpServletRequest.addHeader(ProxyHeader.PROXY_CONTEXT_PATH.getHeader(), FORWARDED_PATH); final OAuth2AuthorizationRequest authorizationRequest = resolver.resolve(httpServletRequest, REGISTRATION_ID); diff --git a/pom.xml b/pom.xml index 3e86021a1e..45f933d36e 100644 --- a/pom.xml +++ b/pom.xml @@ -109,8 +109,8 @@ UTF-8 UTF-8 2014 - 1.12.777 - 2.29.1 + 1.12.778 + 2.29.15 2.11.0 6.13.4 2.0.21 @@ -140,7 +140,7 @@ 4.0.2 3.1.0 2.5.1 - 4.0.23 + 4.0.24 3.5.1 3.4.1 1.2.1 @@ -154,9 +154,9 @@ 2.3 4.1.115.Final 6.1.0 - 6.1.14 + 6.2.0 6.3.4 - 2.2.25 + 2.2.26 2.3.232 3.9.3 3.1.8