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 <exceptionfactory@apache.org>
Co-authored-by: David Handermann <exceptionfactory@apache.org>
Co-authored-by: Pierre Villard <pierre.villard.fr@gmail.com>
This commit is contained in:
Pierre Villard 2024-11-18 15:31:55 +01:00 committed by exceptionfactory
parent ddef74b67f
commit 4e869e661d
No known key found for this signature in database
11 changed files with 40 additions and 26 deletions

View File

@ -28,8 +28,8 @@
<properties>
<!-- when changing the Azure SDK version, also update msal4j to the version that is required by azure-identity -->
<azure.sdk.bom.version>1.2.28</azure.sdk.bom.version>
<msal4j.version>1.17.1</msal4j.version>
<azure.sdk.bom.version>1.2.29</azure.sdk.bom.version>
<msal4j.version>1.17.2</msal4j.version>
<qpid.proton.version>0.34.1</qpid.proton.version>
</properties>

View File

@ -25,7 +25,7 @@
<packaging>pom</packaging>
<properties>
<google.libraries.version>26.49.0</google.libraries.version>
<google.libraries.version>26.50.0</google.libraries.version>
</properties>
<dependencyManagement>

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

10
pom.xml
View File

@ -109,8 +109,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<inceptionYear>2014</inceptionYear>
<com.amazonaws.version>1.12.777</com.amazonaws.version>
<software.amazon.awssdk.version>2.29.1</software.amazon.awssdk.version>
<com.amazonaws.version>1.12.778</com.amazonaws.version>
<software.amazon.awssdk.version>2.29.15</software.amazon.awssdk.version>
<gson.version>2.11.0</gson.version>
<io.fabric8.kubernetes.client.version>6.13.4</io.fabric8.kubernetes.client.version>
<kotlin.version>2.0.21</kotlin.version>
@ -140,7 +140,7 @@
<jakarta.xml.bind-api.version>4.0.2</jakarta.xml.bind-api.version>
<jakarta.ws.rs-api.version>3.1.0</jakarta.ws.rs-api.version>
<json.smart.version>2.5.1</json.smart.version>
<groovy.version>4.0.23</groovy.version>
<groovy.version>4.0.24</groovy.version>
<surefire.version>3.5.1</surefire.version>
<hadoop.version>3.4.1</hadoop.version>
<ozone.version>1.2.1</ozone.version>
@ -154,9 +154,9 @@
<snakeyaml.version>2.3</snakeyaml.version>
<netty.4.version>4.1.115.Final</netty.4.version>
<servlet-api.version>6.1.0</servlet-api.version>
<spring.version>6.1.14</spring.version>
<spring.version>6.2.0</spring.version>
<spring.security.version>6.3.4</spring.security.version>
<swagger.annotations.version>2.2.25</swagger.annotations.version>
<swagger.annotations.version>2.2.26</swagger.annotations.version>
<h2.version>2.3.232</h2.version>
<zookeeper.version>3.9.3</zookeeper.version>
<caffeine.version>3.1.8</caffeine.version>