Skip to content

Commit c73d147

Browse files
authored
refactor: remove data-plane-public-v2 deprecated module from dataplane-base-bom (#4845)
1 parent a69e955 commit c73d147

File tree

9 files changed

+117
-284
lines changed

9 files changed

+117
-284
lines changed

dist/bom/dataplane-base-bom/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ dependencies {
3737
api(project(":extensions:data-plane:data-plane-self-registration"))
3838
api(project(":extensions:data-plane:data-plane-http"))
3939
api(project(":extensions:data-plane:data-plane-http-oauth2"))
40-
api(project(":extensions:data-plane:data-plane-public-api-v2"))
4140
api(project(":extensions:data-plane:data-plane-signaling:data-plane-signaling-api"))
4241
api(project(":extensions:data-plane:data-plane-iam"))
4342
api(project(":extensions:data-plane-selector:data-plane-selector-client"))

resources/openapi/sts-accounts-api.version

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/openapi/sts-api.version

Lines changed: 0 additions & 1 deletion
This file was deleted.

system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/DataPlanePublicApiEndToEndTest.java

Lines changed: 0 additions & 236 deletions
This file was deleted.

system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/DataPlaneSignalingApiEndToEndTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import org.eclipse.edc.connector.api.signaling.transform.to.JsonObjectToDataFlowResponseMessageTransformer;
2424
import org.eclipse.edc.connector.dataplane.spi.DataFlow;
2525
import org.eclipse.edc.connector.dataplane.spi.DataFlowStates;
26+
import org.eclipse.edc.connector.dataplane.spi.Endpoint;
27+
import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGeneratorService;
2628
import org.eclipse.edc.connector.dataplane.spi.store.DataPlaneStore;
2729
import org.eclipse.edc.jsonld.spi.JsonLd;
2830
import org.eclipse.edc.jsonld.util.JacksonJsonLd;
@@ -62,7 +64,7 @@
6264
@EndToEndTest
6365
public class DataPlaneSignalingApiEndToEndTest extends AbstractDataPlaneTest {
6466

65-
private static final String DATAPLANE_PUBLIC_ENDPOINT_URL = DATAPLANE.publicEndpointUrl();
67+
private static final String DATAPLANE_PUBLIC_ENDPOINT_URL = "http://public/endpoint";
6668
private final TypeTransformerRegistry registry = new TypeTransformerRegistryImpl();
6769
private final TypeManager typeManager = mock();
6870
private ObjectMapper mapper;
@@ -76,6 +78,10 @@ void setup() {
7678
registry.register(new JsonObjectToDataAddressDspaceTransformer());
7779
registry.register(new JsonObjectToDataFlowResponseMessageTransformer());
7880
when(typeManager.getMapper("test")).thenReturn(mapper);
81+
runtime.getService(PublicEndpointGeneratorService.class)
82+
.addGeneratorFunction("HttpData", address -> Endpoint.url(DATAPLANE_PUBLIC_ENDPOINT_URL));
83+
runtime.getService(PublicEndpointGeneratorService.class)
84+
.addGeneratorFunction("HttpData", () -> Endpoint.url(DATAPLANE_PUBLIC_ENDPOINT_URL + "/responseChannel"));
7985
}
8086

8187
@DisplayName("Verify the POST /v1/dataflows endpoint returns the correct EDR (PULL)")

system-tests/e2e-dataplane-tests/tests/src/test/java/org/eclipse/edc/test/e2e/participant/DataPlaneParticipant.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ public RequestSpecification baseControlRequest() {
4444
return given().baseUri(dataPlaneControl.get().toString());
4545
}
4646

47-
public RequestSpecification basePublicRequest() {
48-
return given().baseUri(dataPlanePublic.get().toString());
49-
}
50-
51-
public String publicEndpointUrl() {
52-
return dataPlanePublic.get().toString();
53-
}
54-
5547
public Config dataPlaneConfig() {
5648
return ConfigFactory.fromMap(dataPlaneConfiguration());
5749
}
@@ -62,8 +54,6 @@ public Map<String, String> dataPlaneConfiguration() {
6254
put("edc.component.id", UUID.randomUUID().toString());
6355
put("web.http.port", String.valueOf(getFreePort()));
6456
put("web.http.path", "/api");
65-
put("web.http.public.port", String.valueOf(dataPlanePublic.get().getPort()));
66-
put("web.http.public.path", "/public");
6757
put("web.http.control.port", String.valueOf(dataPlaneControl.get().getPort()));
6858
put("web.http.control.path", dataPlaneControl.get().getPath());
6959
put("edc.keystore", resourceAbsolutePath("certs/cert.pfx"));
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* Copyright (c) 2025 Cofinity-X
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Apache License, Version 2.0 which is available at
6+
* https://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* SPDX-License-Identifier: Apache-2.0
9+
*
10+
* Contributors:
11+
* Cofinity-X - initial API and implementation
12+
*
13+
*/
14+
15+
package org.eclipse.edc.test.e2e;
16+
17+
import jakarta.ws.rs.Consumes;
18+
import jakarta.ws.rs.GET;
19+
import jakarta.ws.rs.Path;
20+
import jakarta.ws.rs.Produces;
21+
import jakarta.ws.rs.container.ContainerRequestContext;
22+
import jakarta.ws.rs.core.Context;
23+
import jakarta.ws.rs.core.HttpHeaders;
24+
import jakarta.ws.rs.core.Response;
25+
import org.eclipse.edc.connector.dataplane.spi.Endpoint;
26+
import org.eclipse.edc.connector.dataplane.spi.iam.DataPlaneAuthorizationService;
27+
import org.eclipse.edc.connector.dataplane.spi.iam.PublicEndpointGeneratorService;
28+
import org.eclipse.edc.runtime.metamodel.annotation.Inject;
29+
import org.eclipse.edc.spi.system.ServiceExtension;
30+
import org.eclipse.edc.spi.system.ServiceExtensionContext;
31+
import org.eclipse.edc.web.spi.WebService;
32+
import org.eclipse.edc.web.spi.configuration.PortMapping;
33+
import org.eclipse.edc.web.spi.configuration.PortMappingRegistry;
34+
35+
import static jakarta.ws.rs.core.MediaType.WILDCARD;
36+
import static jakarta.ws.rs.core.Response.Status.FORBIDDEN;
37+
import static jakarta.ws.rs.core.Response.Status.UNAUTHORIZED;
38+
import static java.util.Collections.emptyMap;
39+
import static org.eclipse.edc.util.io.Ports.getFreePort;
40+
41+
/**
42+
* Extension that provides a dummy proxy that always return a hardcoded successful response when the token validation
43+
* succeeds.
44+
*/
45+
public class HttpProxyDataPlaneExtension implements ServiceExtension {
46+
47+
private static final String API_CONTEXT = "proxy";
48+
49+
@Inject
50+
private DataPlaneAuthorizationService authorizationService;
51+
@Inject
52+
private PublicEndpointGeneratorService generatorService;
53+
@Inject
54+
private PortMappingRegistry portMappingRegistry;
55+
@Inject
56+
private WebService webService;
57+
58+
@Override
59+
public void initialize(ServiceExtensionContext context) {
60+
var portMapping = new PortMapping(API_CONTEXT, getFreePort(), "/proxy");
61+
portMappingRegistry.register(portMapping);
62+
63+
var proxyUrl = "http://localhost:%d%s".formatted(portMapping.port(), portMapping.path());
64+
generatorService.addGeneratorFunction("HttpData", address -> Endpoint.url(proxyUrl));
65+
66+
webService.registerResource(API_CONTEXT, new Controller(authorizationService));
67+
}
68+
69+
@Path("{any:.*}")
70+
@Consumes(WILDCARD)
71+
@Produces(WILDCARD)
72+
public static class Controller {
73+
74+
private final DataPlaneAuthorizationService authorizationService;
75+
76+
Controller(DataPlaneAuthorizationService authorizationService) {
77+
this.authorizationService = authorizationService;
78+
}
79+
80+
@GET
81+
public Response get(@Context ContainerRequestContext requestContext) {
82+
var token = requestContext.getHeaderString(HttpHeaders.AUTHORIZATION);
83+
if (token == null) {
84+
return Response.status(UNAUTHORIZED).build();
85+
}
86+
87+
var sourceDataAddress = authorizationService.authorize(token, emptyMap());
88+
if (sourceDataAddress.failed()) {
89+
return Response.status(FORBIDDEN).build();
90+
}
91+
92+
return Response.ok("data").build();
93+
}
94+
}
95+
}

0 commit comments

Comments
 (0)