From 9e3d9b8ed40b0295f6981f82b7ec5acd8e434dd1 Mon Sep 17 00:00:00 2001 From: ndr_brt Date: Tue, 5 Nov 2024 10:01:26 +0100 Subject: [PATCH] refactor: cleanup 0.6.x deprecations --- .../PipelineServiceIntegrationTest.java | 10 -- extensions/common/auth/auth-basic/README.md | 31 ---- .../common/auth/auth-basic/build.gradle.kts | 26 --- .../basic/BasicAuthenticationExtension.java | 66 -------- .../basic/BasicAuthenticationService.java | 120 ------------- .../edc/api/auth/basic/ConfigCredentials.java | 18 -- ...rg.eclipse.edc.spi.system.ServiceExtension | 15 -- .../BasicAuthenticationExtensionTest.java | 62 ------- .../basic/BasicAuthenticationServiceTest.java | 157 ------------------ .../jwt/JwtPresentationVerifier.java | 4 +- .../linkeddata/LdpVerifier.java | 2 +- .../resolution/DidPublicKeyResolverImpl.java | 2 +- .../DidCredentialServiceUrlResolver.java | 2 +- .../service/IdentityAndTrustService.java | 2 +- .../test/system/utils/Participant.java | 54 ------ .../api/v2/DataplaneSelectorApiV2.java | 2 - .../http/pipeline/HttpDataSinkFactory.java | 5 - .../http/pipeline/HttpDataSourceFactory.java | 5 - .../pipeline/HttpDataSinkFactoryTest.java | 14 -- .../pipeline/HttpDataSourceFactoryTest.java | 13 -- .../kafka/pipeline/KafkaDataSinkFactory.java | 5 - .../pipeline/KafkaDataSourceFactory.java | 5 - .../pipeline/KafkaDataSinkFactoryTest.java | 8 - .../pipeline/KafkaDataSourceFactoryTest.java | 8 - settings.gradle.kts | 1 - .../org/eclipse/edc/spi/result/Result.java | 40 ----- .../eclipse/edc/spi/result/ResultTest.java | 36 +--- .../edc/web/spi/configuration/ApiContext.java | 3 - .../policy/spi/PolicyDefinition.java | 5 - .../spi/DataPlaneSelectorService.java | 39 ----- .../spi/pipeline/DataSinkFactory.java | 10 -- .../spi/pipeline/DataSourceFactory.java | 10 -- .../test/e2e/TransferEndToEndParticipant.java | 49 ------ 33 files changed, 8 insertions(+), 821 deletions(-) delete mode 100644 extensions/common/auth/auth-basic/README.md delete mode 100644 extensions/common/auth/auth-basic/build.gradle.kts delete mode 100644 extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationExtension.java delete mode 100644 extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationService.java delete mode 100644 extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/ConfigCredentials.java delete mode 100644 extensions/common/auth/auth-basic/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension delete mode 100644 extensions/common/auth/auth-basic/src/test/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationExtensionTest.java delete mode 100644 extensions/common/auth/auth-basic/src/test/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationServiceTest.java diff --git a/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/pipeline/PipelineServiceIntegrationTest.java b/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/pipeline/PipelineServiceIntegrationTest.java index 86c7f4ae71b..2a08ebea476 100644 --- a/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/pipeline/PipelineServiceIntegrationTest.java +++ b/core/data-plane/data-plane-core/src/test/java/org/eclipse/edc/connector/dataplane/framework/pipeline/PipelineServiceIntegrationTest.java @@ -94,11 +94,6 @@ public String supportedType() { return "any"; } - @Override - public boolean canHandle(DataFlowStartMessage request) { - return true; - } - @Override public DataSink createSink(DataFlowStartMessage request) { return sink; @@ -126,11 +121,6 @@ public String supportedType() { return "any"; } - @Override - public boolean canHandle(DataFlowStartMessage request) { - return true; - } - @Override public DataSource createSource(DataFlowStartMessage request) { return new InputStreamDataSource("test", new ByteArrayInputStream(data.getBytes())); diff --git a/extensions/common/auth/auth-basic/README.md b/extensions/common/auth/auth-basic/README.md deleted file mode 100644 index a41ff9eb3b8..00000000000 --- a/extensions/common/auth/auth-basic/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Basic authentication - -This extension provides a `AuthenticationService` implementation for basic authentication. This module will be active -if you provide at least one credential pair. - -## Usage/Example - -In your `Vault` instance you have to provide the password for each user. You can put them under any key you want, but we -would recommend using the following key format: - -```plain -api-basic-auth- -``` - -Regarding the keys you have to provide in your EDC configuration the vault key for each user: - -```properties -edc.api.auth.basic.usera: api-basic-auth-usera -edc.api.auth.basic.userb: api-basic-auth-userb -``` - -To use this module e.g. together with the Management API and Azure Vault just have to include the following into -your `build.gradle.kts`: - -```kotlin -dependencies { - implementation(project(":extensions:common:vault:vault-azure")) - implementation(project(":extensions:common:auth:auth-basic")) - implementation(project(":extensions:control-plane:api:management-api")) -} -``` diff --git a/extensions/common/auth/auth-basic/build.gradle.kts b/extensions/common/auth/auth-basic/build.gradle.kts deleted file mode 100644 index e2013366b73..00000000000 --- a/extensions/common/auth/auth-basic/build.gradle.kts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2022 ZF Friedrichshafen AG - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - * - * Contributors: - * ZF Friedrichshafen AG - Initial API and Implementation - * - */ - - -plugins { - `java-library` -} - -dependencies { - api(project(":spi:common:auth-spi")) - - testImplementation(project(":core:common:junit")) -} - - diff --git a/extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationExtension.java b/extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationExtension.java deleted file mode 100644 index d8fbf927e47..00000000000 --- a/extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationExtension.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2022 ZF Friedrichshafen AG - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - * - * Contributors: - * ZF Friedrichshafen AG - Initial API and Implementation - * - */ - -package org.eclipse.edc.api.auth.basic; - -import org.eclipse.edc.api.auth.spi.AuthenticationService; -import org.eclipse.edc.api.auth.spi.registry.ApiAuthenticationRegistry; -import org.eclipse.edc.runtime.metamodel.annotation.Extension; -import org.eclipse.edc.runtime.metamodel.annotation.Inject; -import org.eclipse.edc.runtime.metamodel.annotation.Provides; -import org.eclipse.edc.runtime.metamodel.annotation.Setting; -import org.eclipse.edc.spi.security.Vault; -import org.eclipse.edc.spi.system.ServiceExtension; -import org.eclipse.edc.spi.system.ServiceExtensionContext; - -import static java.lang.String.format; - -/** - * Extension that registers an AuthenticationService that uses API Keys - * - * @deprecated this module is not supported anymore and it will be removed in the next iterations. - */ -@Provides(AuthenticationService.class) -@Extension(value = "Basic authentication") -@Deprecated(since = "0.6.5") -public class BasicAuthenticationExtension implements ServiceExtension { - - @Setting(value = "Key-value object defining authentication credentials stored in the vault", type = "map", required = true) - static final String BASIC_AUTH = "edc.api.auth.basic.vault-keys"; - @Inject - private Vault vault; - @Inject - private ApiAuthenticationRegistry authenticationRegistry; - - @Override - public void initialize(ServiceExtensionContext context) { - var monitor = context.getMonitor(); - - monitor.warning("The 'auth-basic' module has been deprecated and it will removed in the next iterations."); - - var credentials = context.getConfig(BASIC_AUTH) - .getRelativeEntries().entrySet().stream() - .map(entry -> new ConfigCredentials(entry.getKey(), entry.getValue())) - .toList(); - - if (!credentials.isEmpty()) { - var authService = new BasicAuthenticationService(vault, credentials, monitor); - authenticationRegistry.register("management-api", authService); - monitor.info(format("API Authentication: basic auth configured with %s credential(s)", credentials.size())); - } else { - monitor.warning("API Authentication: no basic auth credentials provided"); - } - } - -} diff --git a/extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationService.java b/extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationService.java deleted file mode 100644 index a7046156413..00000000000 --- a/extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationService.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2022 ZF Friedrichshafen AG - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - * - * Contributors: - * ZF Friedrichshafen AG - Initial API and Implementation - * - */ - -package org.eclipse.edc.api.auth.basic; - -import org.eclipse.edc.api.auth.spi.AuthenticationService; -import org.eclipse.edc.spi.monitor.Monitor; -import org.eclipse.edc.spi.result.Result; -import org.eclipse.edc.spi.security.Vault; - -import java.util.Base64; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -public class BasicAuthenticationService implements AuthenticationService { - - private static final String BASIC_AUTH_HEADER_NAME = "Authorization"; - private final Base64.Decoder b64Decoder; - private final Vault vault; - private final List basicAuthUsersWithVaultKeyConfigs; - private final Monitor monitor; - - BasicAuthenticationService( - Vault vault, - List basicAuthUsersWithVaultKeyConfigs, - Monitor monitor) { - this.vault = vault; - this.basicAuthUsersWithVaultKeyConfigs = basicAuthUsersWithVaultKeyConfigs; - this.monitor = monitor; - b64Decoder = Base64.getDecoder(); - } - - /** - * Validates if the request is authenticated - * - * @param headers The headers, that contains the credential to be used, in this case the Basic-Auth credentials. - * @return True if the credentials are correct. - */ - @Override - public boolean isAuthenticated(Map> headers) { - Objects.requireNonNull(headers, "headers"); - - return headers.keySet().stream() - .filter(k -> k.equalsIgnoreCase(BASIC_AUTH_HEADER_NAME)) - .map(headers::get) - .filter(list -> !list.isEmpty()) - .anyMatch(list -> list.stream() - .map(this::decodeAuthHeader) - .anyMatch(this::checkBasicAuthValid)); - } - - /** - * Decodes the base64 request header. - * - * @param authHeader Base64 encoded credentials from the request header - * @return Array with the encoded credentials. First is the username and the second the password. If there was a - * problem an array with 0 entries will be returned. - */ - private Result decodeAuthHeader(String authHeader) { - String[] authCredentials; - var separatedAuthHeader = authHeader.split(" "); - - if (separatedAuthHeader.length != 2) { - return Result.failure("Authorization header value is not a valid Bearer token"); - } - - try { - authCredentials = new String(b64Decoder.decode(separatedAuthHeader[1])).split(":"); - } catch (IllegalArgumentException ex) { - return Result.failure("Authorization header could no base64 decoded"); - } - - if (authCredentials.length != 2) { - return Result.failure("Authorization header could be base64 decoded but is not in format of 'username:password'"); - } - - return Result.success(new BasicAuthCredentials(authCredentials[0], authCredentials[1])); - } - - /** - * Checks if the provided credentials are in the internal registered once and if the password is correct. - * - * @param authCredentials {@link BasicAuthenticationService.BasicAuthCredentials} - * used in the request. - * @return True if credentials are correct - */ - private boolean checkBasicAuthValid(Result authCredentials) { - if (authCredentials.failed()) { - authCredentials.getFailureMessages().forEach(monitor::debug); - return false; - } - - var creds = authCredentials.getContent(); - - return basicAuthUsersWithVaultKeyConfigs.stream() - .anyMatch(it -> it.username().equals(creds.username) && Objects.equals(vault.resolveSecret(it.vaultKey()), creds.password)); - } - - static class BasicAuthCredentials { - String username; - String password; - - BasicAuthCredentials(String username, String password) { - this.username = username; - this.password = password; - } - } -} diff --git a/extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/ConfigCredentials.java b/extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/ConfigCredentials.java deleted file mode 100644 index dde29b429ae..00000000000 --- a/extensions/common/auth/auth-basic/src/main/java/org/eclipse/edc/api/auth/basic/ConfigCredentials.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - * - * Contributors: - * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation - * - */ - -package org.eclipse.edc.api.auth.basic; - -record ConfigCredentials(String username, String vaultKey) { -} diff --git a/extensions/common/auth/auth-basic/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension b/extensions/common/auth/auth-basic/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension deleted file mode 100644 index 37dcd49e65b..00000000000 --- a/extensions/common/auth/auth-basic/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension +++ /dev/null @@ -1,15 +0,0 @@ - # -# Copyright (c) 2022 ZF Friedrichshafen AG -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0 -# -# SPDX-License-Identifier: Apache-2.0 -# -# Contributors: -# ZF Friedrichshafen AG - Initial API and Implementation -# -# - -org.eclipse.edc.api.auth.basic.BasicAuthenticationExtension diff --git a/extensions/common/auth/auth-basic/src/test/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationExtensionTest.java b/extensions/common/auth/auth-basic/src/test/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationExtensionTest.java deleted file mode 100644 index e9556274458..00000000000 --- a/extensions/common/auth/auth-basic/src/test/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationExtensionTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - * - * Contributors: - * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation - * - */ - -package org.eclipse.edc.api.auth.basic; - -import org.eclipse.edc.api.auth.spi.registry.ApiAuthenticationRegistry; -import org.eclipse.edc.junit.extensions.DependencyInjectionExtension; -import org.eclipse.edc.spi.system.ServiceExtensionContext; -import org.eclipse.edc.spi.system.configuration.ConfigFactory; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - -import java.util.Map; - -import static org.eclipse.edc.api.auth.basic.BasicAuthenticationExtension.BASIC_AUTH; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoInteractions; -import static org.mockito.Mockito.when; - -@ExtendWith(DependencyInjectionExtension.class) -class BasicAuthenticationExtensionTest { - - private final ApiAuthenticationRegistry apiAuthenticationRegistry = mock(); - - @BeforeEach - void setUp(ServiceExtensionContext context) { - context.registerService(ApiAuthenticationRegistry.class, apiAuthenticationRegistry); - } - - @Test - void shouldRegisterApiAuthorization(BasicAuthenticationExtension extension, ServiceExtensionContext context) { - when(context.getConfig(BASIC_AUTH)).thenReturn(ConfigFactory.fromMap(Map.of("edc.api.auth.basic.vault-keys.key", "value"))); - - extension.initialize(context); - - verify(apiAuthenticationRegistry).register(eq("management-api"), isA(BasicAuthenticationService.class)); - } - - @Test - void shouldNoRegisterApiAuthentication_whenNoConfigProvided(BasicAuthenticationExtension extension, ServiceExtensionContext context) { - when(context.getConfig(BASIC_AUTH)).thenReturn(ConfigFactory.empty()); - - extension.initialize(context); - - verifyNoInteractions(apiAuthenticationRegistry); - } -} diff --git a/extensions/common/auth/auth-basic/src/test/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationServiceTest.java b/extensions/common/auth/auth-basic/src/test/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationServiceTest.java deleted file mode 100644 index f73354aba4f..00000000000 --- a/extensions/common/auth/auth-basic/src/test/java/org/eclipse/edc/api/auth/basic/BasicAuthenticationServiceTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2022 ZF Friedrichshafen AG - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - * - * Contributors: - * ZF Friedrichshafen AG - Initial API and Implementation - * - */ - -package org.eclipse.edc.api.auth.basic; - -import org.eclipse.edc.spi.monitor.Monitor; -import org.eclipse.edc.spi.security.Vault; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; - -import java.util.Base64; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import static java.lang.String.format; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -class BasicAuthenticationServiceTest { - - private static final List TEST_CREDENTIALS = List.of( - new ConfigCredentials("usera", "api-basic-auth-usera"), - new ConfigCredentials("userb", "api-basic-auth-userb") - ); - private static final Base64.Encoder BASE_64_ENCODER = Base64.getEncoder(); - - private final List testCredentialsEncoded = List.of( - generateBearerToken(format("%s:%s", "usera", "password1")), - generateBearerToken(format("%s:%s", "userb", "password2")) - ); - - private BasicAuthenticationService service; - private Vault vault; - - @BeforeEach - void setUp() { - vault = mock(Vault.class); - when(vault.resolveSecret("api-basic-auth-usera")).thenReturn("password1"); - when(vault.resolveSecret("api-basic-auth-userb")).thenReturn("password2"); - - service = new BasicAuthenticationService(vault, TEST_CREDENTIALS, mock(Monitor.class)); - } - - @ParameterizedTest - @ValueSource(strings = { "Authorization", "authorization", "authoRization" }) - void isAuthorized(String validKey) { - var map = Map.of(validKey, List.of(testCredentialsEncoded.get(0))); - var map2 = Map.of(validKey, List.of(testCredentialsEncoded.get(1))); - assertThat(service.isAuthenticated(map)).isTrue(); - assertThat(service.isAuthenticated(map2)).isTrue(); - } - - @Test - void isAuthorized_headerNotPresent() { - var map = Map.of("header1", List.of("val1, val2"), - "header2", List.of("anotherval1", "anotherval2")); - assertThat(service.isAuthenticated(map)).isFalse(); - } - - @Test - void isAuthorized_headersEmpty() { - Map> map = Collections.emptyMap(); - assertThat(service.isAuthenticated(map)).isFalse(); - } - - @Test - void isAuthorized_headersNull() { - assertThatThrownBy(() -> service.isAuthenticated(null)) - .isInstanceOf(NullPointerException.class); - } - - @Test - void isAuthorized_notAuthorized() { - var map = Map.of( - "authorization", List.of(generateBearerToken("invalid-user:random")) - ); - assertThat(service.isAuthenticated(map)).isFalse(); - } - - @Test - void isAuthorized_decoderError_notBearerToken() { - var map = Map.of("authorization", List.of("invalid_auth_header_value")); - assertThat(service.isAuthenticated(map)).isFalse(); - } - - @Test - void isAuthorized_decoderError_notValidBearerToken() { - var map = Map.of("authorization", List.of("Bearer invalid_token")); - assertThat(service.isAuthenticated(map)).isFalse(); - } - - @Test - void isAuthorized_decoderError_missingColon() { - var map = Map.of("authorization", List.of(generateBearerToken("missingcolon"))); - assertThat(service.isAuthenticated(map)).isFalse(); - } - - @Test - void isAuthorized_multipleValues_firstAuthorized() { - var map = Map.of("authorization", List.of( - testCredentialsEncoded.get(0), - generateBearerToken("invalid-user:random") - )); - assertThat(service.isAuthenticated(map)).isTrue(); - } - - @Test - void isAuthorized_multipleValues_secondAuthorized() { - var map = Map.of("authorization", List.of( - generateBearerToken("invalid-user:random"), - testCredentialsEncoded.get(0) - )); - assertThat(service.isAuthenticated(map)).isTrue(); - } - - @Test - void isAuthorized_multipleValues_notAuthorized() { - var map = Map.of( - "authorization", List.of( - generateBearerToken("invalid-user:random"), - generateBearerToken("invalid-user2:random2") - ) - ); - assertThat(service.isAuthenticated(map)).isFalse(); - } - - @Test - void isAuthorized_wrongVaultKey() { - var wrongVaultKeyConfig = List.of( - new ConfigCredentials("usera", "wrong.key") - ); - var service = new BasicAuthenticationService(vault, wrongVaultKeyConfig, mock(Monitor.class)); - var map = Map.of("authorization", List.of(testCredentialsEncoded.get(0))); - - assertThat(service.isAuthenticated(map)).isFalse(); - } - - private String generateBearerToken(String plainCredentials) { - return format("Bearer %s", BASE_64_ENCODER.encodeToString(plainCredentials.getBytes())); - } -} diff --git a/extensions/common/crypto/jwt-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/jwt/JwtPresentationVerifier.java b/extensions/common/crypto/jwt-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/jwt/JwtPresentationVerifier.java index 29dab9b6a4e..8f82f3deef0 100644 --- a/extensions/common/crypto/jwt-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/jwt/JwtPresentationVerifier.java +++ b/extensions/common/crypto/jwt-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/jwt/JwtPresentationVerifier.java @@ -116,7 +116,7 @@ public Result verify(String serializedJwt, VerifierContext context) { var rules = new ArrayList<>(tokenValidationRulesRegistry.getRules(JWT_VC_TOKEN_CONTEXT)); rules.add(new IssuerKeyIdValidationRule(keyId)); return tokenValidationService.validate(serializedJwt, publicKeyResolver, rules) - .mapTo(); + .mapEmpty(); } if (!isPresentation(signedJwt)) { @@ -146,7 +146,7 @@ public Result verify(String serializedJwt, VerifierContext context) { } catch (ParseException e) { throw new RuntimeException(e); } - return verificationResult.mapTo(); + return verificationResult.mapEmpty(); } private List vpValidationRules(String audience, String keyId) { diff --git a/extensions/common/crypto/ldp-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/linkeddata/LdpVerifier.java b/extensions/common/crypto/ldp-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/linkeddata/LdpVerifier.java index a87b7f1b86f..a332f43c7e0 100644 --- a/extensions/common/crypto/ldp-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/linkeddata/LdpVerifier.java +++ b/extensions/common/crypto/ldp-verifiable-credentials/src/main/java/org/eclipse/edc/verifiablecredentials/linkeddata/LdpVerifier.java @@ -169,7 +169,7 @@ private Result verifyExpanded(JsonObject expanded, VerifierContext context // verify presentation proofs var presentationValidation = verifyProofs(expanded, ldContext); if (!presentationValidation.succeeded()) { - return presentationValidation.mapTo(); + return presentationValidation.mapFailure(); } // verify embedded credentials diff --git a/extensions/common/iam/decentralized-identity/identity-did-core/src/main/java/org/eclipse/edc/iam/did/resolution/DidPublicKeyResolverImpl.java b/extensions/common/iam/decentralized-identity/identity-did-core/src/main/java/org/eclipse/edc/iam/did/resolution/DidPublicKeyResolverImpl.java index 768d3a932b5..be9673e15ac 100644 --- a/extensions/common/iam/decentralized-identity/identity-did-core/src/main/java/org/eclipse/edc/iam/did/resolution/DidPublicKeyResolverImpl.java +++ b/extensions/common/iam/decentralized-identity/identity-did-core/src/main/java/org/eclipse/edc/iam/did/resolution/DidPublicKeyResolverImpl.java @@ -74,7 +74,7 @@ protected Result resolveInternal(String id) { private Result resolveDidPublicKey(String didUrl, String verificationMethodUrl, @Nullable String keyId) { var didResult = resolverRegistry.resolve(didUrl); if (didResult.failed()) { - return didResult.mapTo(); + return didResult.mapFailure(); } var didDocument = didResult.getContent(); diff --git a/extensions/common/iam/identity-trust/identity-trust-service/src/main/java/org/eclipse/edc/iam/identitytrust/service/DidCredentialServiceUrlResolver.java b/extensions/common/iam/identity-trust/identity-trust-service/src/main/java/org/eclipse/edc/iam/identitytrust/service/DidCredentialServiceUrlResolver.java index 8ba19b4723e..a5ec1f662f4 100644 --- a/extensions/common/iam/identity-trust/identity-trust-service/src/main/java/org/eclipse/edc/iam/identitytrust/service/DidCredentialServiceUrlResolver.java +++ b/extensions/common/iam/identity-trust/identity-trust-service/src/main/java/org/eclipse/edc/iam/identitytrust/service/DidCredentialServiceUrlResolver.java @@ -43,7 +43,7 @@ public DidCredentialServiceUrlResolver(DidResolverRegistry didResolverRegistry) public Result resolve(String issuer) { var didDocument = didResolverRegistry.resolve(issuer); if (didDocument.failed()) { - return didDocument.mapTo(); + return didDocument.mapFailure(); } return didDocument.getContent().getService().stream() .filter(s -> s.getType().equals(CREDENTIAL_SERVICE_TYPE)) diff --git a/extensions/common/iam/identity-trust/identity-trust-service/src/main/java/org/eclipse/edc/iam/identitytrust/service/IdentityAndTrustService.java b/extensions/common/iam/identity-trust/identity-trust-service/src/main/java/org/eclipse/edc/iam/identitytrust/service/IdentityAndTrustService.java index 70169f67eb0..f83f6387314 100644 --- a/extensions/common/iam/identity-trust/identity-trust-service/src/main/java/org/eclipse/edc/iam/identitytrust/service/IdentityAndTrustService.java +++ b/extensions/common/iam/identity-trust/identity-trust-service/src/main/java/org/eclipse/edc/iam/identitytrust/service/IdentityAndTrustService.java @@ -142,7 +142,7 @@ public Result verifyJwtToken(TokenRepresentation tokenRepresentation EXPIRATION_TIME, Instant.now().plus(5, ChronoUnit.MINUTES).toString()); var siToken = secureTokenService.createToken(siTokenClaims, null); if (siToken.failed()) { - return siToken.mapTo(); + return siToken.mapFailure(); } var siTokenString = siToken.getContent().getToken(); diff --git a/extensions/control-plane/api/management-api/management-api-test-fixtures/src/testFixtures/java/org/eclipse/edc/connector/controlplane/test/system/utils/Participant.java b/extensions/control-plane/api/management-api/management-api-test-fixtures/src/testFixtures/java/org/eclipse/edc/connector/controlplane/test/system/utils/Participant.java index 0ae3e3f95a9..f7f336ecb9f 100644 --- a/extensions/control-plane/api/management-api/management-api-test-fixtures/src/testFixtures/java/org/eclipse/edc/connector/controlplane/test/system/utils/Participant.java +++ b/extensions/control-plane/api/management-api/management-api-test-fixtures/src/testFixtures/java/org/eclipse/edc/connector/controlplane/test/system/utils/Participant.java @@ -436,60 +436,6 @@ public RequestAsset requestAssetFrom(String assetId, Participant provider) { return new RequestAsset(assetId, provider); } - /** - * Request a provider asset: - * - retrieves the contract definition associated with the asset, - * - handles the contract negotiation, - * - initiate the data transfer. - * - * @param provider data provider - * @param assetId asset id - * @param privateProperties private properties of the data request - * @param destination data destination - * @return transfer process id. - * @deprecated please use {@link #requestAssetFrom(String, Participant)} instead - */ - @Deprecated(since = "0.6.1") - public String requestAsset(Participant provider, String assetId, JsonObject privateProperties, JsonObject destination) { - return requestAssetFrom(assetId, provider) - .withPrivateProperties(privateProperties) - .withDestination(destination) - .execute(); - } - - /** - * Request a provider asset: - * - retrieves the contract definition associated with the asset, - * - handles the contract negotiation, - * - initiate the data transfer. - * - * @param provider data provider - * @param assetId asset id - * @param privateProperties private properties of the data request - * @param destination data destination - * @param transferType transfer type - * @return transfer process id. - * @deprecated please use {@link #requestAssetFrom(String, Participant)} instead - */ - @Deprecated(since = "0.6.1") - public String requestAsset(Participant provider, String assetId, JsonObject privateProperties, JsonObject destination, String transferType) { - return requestAssetFrom(assetId, provider) - .withPrivateProperties(privateProperties) - .withDestination(destination) - .withTransferType(transferType) - .execute(); - } - - @Deprecated(since = "0.6.1") - public String requestAsset(Participant provider, String assetId, JsonObject privateProperties, JsonObject destination, String transferType, JsonArray callbacks) { - return requestAssetFrom(assetId, provider) - .withPrivateProperties(privateProperties) - .withDestination(destination) - .withTransferType(transferType) - .withCallbacks(callbacks) - .execute(); - } - /** * Get current state of a transfer process. * diff --git a/extensions/data-plane-selector/data-plane-selector-api/src/main/java/org/eclipse/edc/connector/dataplane/selector/api/v2/DataplaneSelectorApiV2.java b/extensions/data-plane-selector/data-plane-selector-api/src/main/java/org/eclipse/edc/connector/dataplane/selector/api/v2/DataplaneSelectorApiV2.java index b84c2d10add..d38a696d946 100644 --- a/extensions/data-plane-selector/data-plane-selector-api/src/main/java/org/eclipse/edc/connector/dataplane/selector/api/v2/DataplaneSelectorApiV2.java +++ b/extensions/data-plane-selector/data-plane-selector-api/src/main/java/org/eclipse/edc/connector/dataplane/selector/api/v2/DataplaneSelectorApiV2.java @@ -46,7 +46,6 @@ public interface DataplaneSelectorApiV2 { @ApiResponse(responseCode = "400", description = "Request body was malformed", content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiCoreSchema.ApiErrorDetailSchema.class)))) }) - @Deprecated(since = "0.6.4") @POST JsonObject selectDataPlaneInstanceV2(JsonObject request); @@ -61,7 +60,6 @@ public interface DataplaneSelectorApiV2 { deprecated = true ) @POST - @Deprecated(since = "0.6.2") JsonObject addDataPlaneInstanceV2(JsonObject instance); @Operation(method = "GET", diff --git a/extensions/data-plane/data-plane-http/src/main/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSinkFactory.java b/extensions/data-plane/data-plane-http/src/main/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSinkFactory.java index e03aba577a3..90373d96389 100644 --- a/extensions/data-plane/data-plane-http/src/main/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSinkFactory.java +++ b/extensions/data-plane/data-plane-http/src/main/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSinkFactory.java @@ -59,11 +59,6 @@ public String supportedType() { return HTTP_DATA_TYPE; } - @Override - public boolean canHandle(DataFlowStartMessage request) { - return HTTP_DATA_TYPE.equals(request.getDestinationDataAddress().getType()); - } - @Override public @NotNull Result validateRequest(DataFlowStartMessage request) { try { diff --git a/extensions/data-plane/data-plane-http/src/main/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSourceFactory.java b/extensions/data-plane/data-plane-http/src/main/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSourceFactory.java index 29fb1c4cef4..7366b569de3 100644 --- a/extensions/data-plane/data-plane-http/src/main/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSourceFactory.java +++ b/extensions/data-plane/data-plane-http/src/main/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSourceFactory.java @@ -51,11 +51,6 @@ public String supportedType() { return HTTP_DATA_TYPE; } - @Override - public boolean canHandle(DataFlowStartMessage request) { - return HTTP_DATA_TYPE.equals(request.getSourceDataAddress().getType()); - } - @Override public @NotNull Result validateRequest(DataFlowStartMessage request) { try { diff --git a/extensions/data-plane/data-plane-http/src/test/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSinkFactoryTest.java b/extensions/data-plane/data-plane-http/src/test/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSinkFactoryTest.java index 5016452e9a7..3678a0e37f5 100644 --- a/extensions/data-plane/data-plane-http/src/test/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSinkFactoryTest.java +++ b/extensions/data-plane/data-plane-http/src/test/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSinkFactoryTest.java @@ -22,7 +22,6 @@ import org.eclipse.edc.connector.dataplane.http.spi.HttpDataAddress; import org.eclipse.edc.connector.dataplane.http.spi.HttpRequestParams; import org.eclipse.edc.connector.dataplane.http.spi.HttpRequestParamsProvider; -import org.eclipse.edc.connector.dataplane.http.testfixtures.TestFunctions; import org.eclipse.edc.connector.dataplane.spi.pipeline.InputStreamDataSource; import org.eclipse.edc.http.spi.EdcHttpClient; import org.eclipse.edc.spi.EdcException; @@ -45,7 +44,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.connector.dataplane.http.testfixtures.TestFunctions.createHttpResponse; -import static org.eclipse.edc.dataaddress.httpdata.spi.HttpDataAddressSchema.HTTP_DATA_TYPE; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -65,18 +63,6 @@ void setUp() { factory = new HttpDataSinkFactory(httpClient, executorService, 5, monitor, provider, requestFactory); } - @Deprecated(since = "0.6.2") - @Test - void verifyCanHandle() { - assertThat(factory.canHandle(TestFunctions.createRequest(HTTP_DATA_TYPE).build())).isTrue(); - } - - @Deprecated(since = "0.6.2") - @Test - void verifyCannotHandle() { - assertThat(factory.canHandle(TestFunctions.createRequest("dummy").build())).isFalse(); - } - @Test void verifyValidationFailsIfProviderThrows() { var errorMsg = "Test error message"; diff --git a/extensions/data-plane/data-plane-http/src/test/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSourceFactoryTest.java b/extensions/data-plane/data-plane-http/src/test/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSourceFactoryTest.java index 05080713e94..55691adc422 100644 --- a/extensions/data-plane/data-plane-http/src/test/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSourceFactoryTest.java +++ b/extensions/data-plane/data-plane-http/src/test/java/org/eclipse/edc/connector/dataplane/http/pipeline/HttpDataSourceFactoryTest.java @@ -33,7 +33,6 @@ import static java.util.Collections.emptyMap; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.edc.dataaddress.httpdata.spi.HttpDataAddressSchema.HTTP_DATA_TYPE; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -51,18 +50,6 @@ void setUp() { factory = new HttpDataSourceFactory(httpClient, provider, monitor, requestFactory); } - @Deprecated(since = "0.6.2") - @Test - void verifyCanHandle() { - assertThat(factory.canHandle(TestFunctions.createRequest(HTTP_DATA_TYPE).build())).isTrue(); - } - - @Deprecated(since = "0.6.2") - @Test - void verifyCannotHandle() { - assertThat(factory.canHandle(TestFunctions.createRequest("dummy").build())).isFalse(); - } - @Test void verifyValidationFailsIfSupplierThrows() { var errorMsg = "Test error message"; diff --git a/extensions/data-plane/data-plane-kafka/src/main/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSinkFactory.java b/extensions/data-plane/data-plane-kafka/src/main/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSinkFactory.java index d4594134e84..5bb2c221d51 100644 --- a/extensions/data-plane/data-plane-kafka/src/main/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSinkFactory.java +++ b/extensions/data-plane/data-plane-kafka/src/main/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSinkFactory.java @@ -53,11 +53,6 @@ public String supportedType() { return KAFKA_TYPE; } - @Override - public boolean canHandle(DataFlowStartMessage dataRequest) { - return KAFKA_TYPE.equalsIgnoreCase(dataRequest.getDestinationDataAddress().getType()); - } - @Override public @NotNull Result validateRequest(DataFlowStartMessage request) { var destination = request.getDestinationDataAddress(); diff --git a/extensions/data-plane/data-plane-kafka/src/main/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSourceFactory.java b/extensions/data-plane/data-plane-kafka/src/main/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSourceFactory.java index 6c42df5bcb7..b747cc89521 100644 --- a/extensions/data-plane/data-plane-kafka/src/main/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSourceFactory.java +++ b/extensions/data-plane/data-plane-kafka/src/main/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSourceFactory.java @@ -59,11 +59,6 @@ public String supportedType() { return KAFKA_TYPE; } - @Override - public boolean canHandle(DataFlowStartMessage dataRequest) { - return KAFKA_TYPE.equalsIgnoreCase(dataRequest.getSourceDataAddress().getType()); - } - @Override public @NotNull Result validateRequest(DataFlowStartMessage request) { var source = request.getSourceDataAddress(); diff --git a/extensions/data-plane/data-plane-kafka/src/test/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSinkFactoryTest.java b/extensions/data-plane/data-plane-kafka/src/test/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSinkFactoryTest.java index a3fd32c717a..1a40e5f50de 100644 --- a/extensions/data-plane/data-plane-kafka/src/test/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSinkFactoryTest.java +++ b/extensions/data-plane/data-plane-kafka/src/test/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSinkFactoryTest.java @@ -47,14 +47,6 @@ public void setUp() { factory = new KafkaDataSinkFactory(mock(ExecutorService.class), mock(Monitor.class), propertiesFactory, 1); } - @Deprecated(since = "0.6.2") - @Test - void verifyCanHandle() { - assertThat(factory.canHandle(createRequest("kafka", emptyMap()))).isTrue(); - assertThat(factory.canHandle(createRequest("KaFka", emptyMap()))).isTrue(); - assertThat(factory.canHandle(createRequest("kafkax", emptyMap()))).isFalse(); - } - @Test void verifyValidateSuccess() { var request = createRequest(KAFKA_TYPE, Map.of(TOPIC, "test", BOOTSTRAP_SERVERS, "any:9183")); diff --git a/extensions/data-plane/data-plane-kafka/src/test/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSourceFactoryTest.java b/extensions/data-plane/data-plane-kafka/src/test/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSourceFactoryTest.java index 9bfa6a7c2d2..0a0621a6455 100644 --- a/extensions/data-plane/data-plane-kafka/src/test/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSourceFactoryTest.java +++ b/extensions/data-plane/data-plane-kafka/src/test/java/org/eclipse/edc/connector/dataplane/kafka/pipeline/KafkaDataSourceFactoryTest.java @@ -47,14 +47,6 @@ public void setUp() { factory = new KafkaDataSourceFactory(mock(Monitor.class), propertiesFactory, mock(Clock.class)); } - @Deprecated(since = "0.6.2") - @Test - void verifyCanHandle() { - assertThat(factory.canHandle(createRequest("kafka", emptyMap()))).isTrue(); - assertThat(factory.canHandle(createRequest("KaFka", emptyMap()))).isTrue(); - assertThat(factory.canHandle(createRequest("kafkax", emptyMap()))).isFalse(); - } - @Test void verifyValidateSuccess() { var request = createRequest(KAFKA_TYPE, Map.of(TOPIC, "test", BOOTSTRAP_SERVERS, "any")); diff --git a/settings.gradle.kts b/settings.gradle.kts index ba4a162ca93..0852091a239 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -109,7 +109,6 @@ include(":extensions:common:api:api-core") include(":extensions:common:api:api-observability") include(":extensions:common:api:lib:management-api-lib") include(":extensions:common:api:version-api") -include(":extensions:common:auth:auth-basic") include(":extensions:common:auth:auth-tokenbased") include(":extensions:common:auth:auth-delegated") include(":extensions:common:auth:auth-configuration") diff --git a/spi/common/boot-spi/src/main/java/org/eclipse/edc/spi/result/Result.java b/spi/common/boot-spi/src/main/java/org/eclipse/edc/spi/result/Result.java index b511f975d3b..57af8fd91ef 100644 --- a/spi/common/boot-spi/src/main/java/org/eclipse/edc/spi/result/Result.java +++ b/spi/common/boot-spi/src/main/java/org/eclipse/edc/spi/result/Result.java @@ -21,7 +21,6 @@ import java.util.Collections; import java.util.List; import java.util.Optional; -import java.util.function.Function; import java.util.function.Supplier; /** @@ -91,45 +90,6 @@ public Result merge(Result other) { } } - /** - * Maps this {@link Result} into another, maintaining the basic semantics (failed vs success). If this - * {@link Result} is successful, the content is discarded. If this {@link Result} failed, the failures are carried - * over. This method is intended for use when the return type is implicit, for example: - *
-     *   public Result<Void> someMethod() {
-     *      Result<String> result = getStringResult();
-     *      return result.mapTo();
-     *   }
-     * 
- * - * @see Result#map(Function) - * @see Result#mapTo(Class) - * @deprecated please use {@link #mapEmpty()} or {@link #mapFailure()}. - */ - @Deprecated(since = "0.6.4") - public Result mapTo() { - return mapEmpty(); - } - - /** - * Maps this {@link Result} into another, maintaining the basic semantics (failed vs success). If this - * {@link Result} is successful, the content is discarded. If this {@link Result} failed, the failures are carried - * over. This method is intended for use when an explicit return type is needed, for example when using var: - *
-     *      Result<String> result = getStringResult();
-     *      var voidResult = result.mapTo(Void.class);
-     * 
- * - * @param clazz type of the result, with which the resulting {@link Result} should be parameterized - * @see Result#map(Function) - * @see Result#mapTo() - * @deprecated please use {@link #mapEmpty()} or {@link #mapFailure()}. - */ - @Deprecated(since = "0.6.4") - public Result mapTo(Class clazz) { - return mapEmpty(); - } - /** * Converts this result into an {@link Optional}. When this result is failed, or there is no content, * {@link Optional#isEmpty()} is returned, otherwise the content is the {@link Optional}'s value diff --git a/spi/common/boot-spi/src/test/java/org/eclipse/edc/spi/result/ResultTest.java b/spi/common/boot-spi/src/test/java/org/eclipse/edc/spi/result/ResultTest.java index 05f2443b5de..298145b8dda 100644 --- a/spi/common/boot-spi/src/test/java/org/eclipse/edc/spi/result/ResultTest.java +++ b/spi/common/boot-spi/src/test/java/org/eclipse/edc/spi/result/ResultTest.java @@ -146,38 +146,6 @@ void mapToEmpty_failed() { assertThat(mapped).isFailed().detail().isEqualTo("foobar"); } - @Test - void mapTo_succeeded() { - var res = Result.success("foobar"); - Result mapped = res.mapTo(); - assertThat(mapped.succeeded()).isTrue(); - assertThat(mapped.getContent()).isNull(); - } - - @Test - void mapTo_failed() { - var res = Result.failure("foobar"); - Result mapped = res.mapTo(); - assertThat(mapped.failed()).isTrue(); - assertThat(mapped.getFailureDetail()).isEqualTo("foobar"); - } - - @Test - void mapTo_explicitType_succeeded() { - var res = Result.success("foobar"); - var mapped = res.mapTo(Object.class); - assertThat(mapped.succeeded()).isTrue(); - assertThat(mapped.getContent()).isNull(); - } - - @Test - void mapTo_explicitType_failed() { - var res = Result.failure("foobar"); - var mapped = res.mapTo(String.class); - assertThat(mapped.failed()).isTrue(); - assertThat(mapped.getFailureDetail()).isEqualTo("foobar"); - } - @Test void whenSuccess_chainsSuccesses() { var result1 = Result.success("res1"); @@ -190,10 +158,10 @@ void whenSuccess_chainsSuccesses() { @Test void whenSuccess_middleOneFails() { var result1 = Result.success("res1"); - var finalResult = result1 + Result finalResult = result1 .flatMap(r -> Result.success("res2")) .flatMap(r -> Result.failure("some failure")) - .flatMap(Result::mapTo); + .flatMap(Result::mapEmpty); assertThat(finalResult.failed()).isTrue(); assertThat(finalResult.getFailureDetail()).isEqualTo("some failure"); diff --git a/spi/common/web-spi/src/main/java/org/eclipse/edc/web/spi/configuration/ApiContext.java b/spi/common/web-spi/src/main/java/org/eclipse/edc/web/spi/configuration/ApiContext.java index 68a4b59cfd3..4c7661de6bc 100644 --- a/spi/common/web-spi/src/main/java/org/eclipse/edc/web/spi/configuration/ApiContext.java +++ b/spi/common/web-spi/src/main/java/org/eclipse/edc/web/spi/configuration/ApiContext.java @@ -27,7 +27,4 @@ public interface ApiContext { String STS = "sts"; String STS_ACCOUNTS = "accounts"; - @Deprecated(since = "0.6.4") - String SIGNALING = "signaling"; - } diff --git a/spi/control-plane/policy-spi/src/main/java/org/eclipse/edc/connector/controlplane/policy/spi/PolicyDefinition.java b/spi/control-plane/policy-spi/src/main/java/org/eclipse/edc/connector/controlplane/policy/spi/PolicyDefinition.java index cde2f601c7d..b613b651a12 100644 --- a/spi/control-plane/policy-spi/src/main/java/org/eclipse/edc/connector/controlplane/policy/spi/PolicyDefinition.java +++ b/spi/control-plane/policy-spi/src/main/java/org/eclipse/edc/connector/controlplane/policy/spi/PolicyDefinition.java @@ -70,11 +70,6 @@ public boolean equals(Object o) { return Objects.equals(id, that.id) && policy.equals(that.policy); } - @Deprecated(since = "0.6.0", forRemoval = true) - public String getUid() { - return id; - } - @NotNull public Map getPrivateProperties() { return privateProperties; diff --git a/spi/data-plane-selector/data-plane-selector-spi/src/main/java/org/eclipse/edc/connector/dataplane/selector/spi/DataPlaneSelectorService.java b/spi/data-plane-selector/data-plane-selector-spi/src/main/java/org/eclipse/edc/connector/dataplane/selector/spi/DataPlaneSelectorService.java index 8530bc278a9..3c7cf7a0722 100644 --- a/spi/data-plane-selector/data-plane-selector-spi/src/main/java/org/eclipse/edc/connector/dataplane/selector/spi/DataPlaneSelectorService.java +++ b/spi/data-plane-selector/data-plane-selector-spi/src/main/java/org/eclipse/edc/connector/dataplane/selector/spi/DataPlaneSelectorService.java @@ -75,43 +75,4 @@ public interface DataPlaneSelectorService { */ ServiceResult findById(String id); - /** - * Selects the {@link DataPlaneInstance} that can handle a source and destination {@link DataAddress} using the configured - * strategy. - * - * @deprecated please use the one that passes the transferType - */ - @Deprecated(since = "0.6.3") - default DataPlaneInstance select(DataAddress source, DataAddress destination) { - return select(source, destination, "random"); - } - - /** - * Selects the {@link DataPlaneInstance} that can handle a source and destination {@link DataAddress} using the passed - * strategy. - * - * @deprecated please use the one that passes the transferType - */ - @Deprecated(since = "0.6.3") - default DataPlaneInstance select(DataAddress source, DataAddress destination, String selectionStrategy) { - return select(source, destination, selectionStrategy, null); - } - - /** - * Selects the {@link DataPlaneInstance} that can handle a source and destination {@link DataAddress} using the passed - * strategy and the optional transferType. - * - * @deprecated please use {@link #select(DataAddress, String, String)}. - */ - @Deprecated(since = "0.6.4") - default DataPlaneInstance select(DataAddress source, DataAddress destination, @Nullable String selectionStrategy, @Nullable String transferType) { - var selection = select(source, transferType, selectionStrategy); - if (selection.succeeded()) { - return selection.getContent(); - } else { - return null; - } - } - - } diff --git a/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/pipeline/DataSinkFactory.java b/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/pipeline/DataSinkFactory.java index 5ca834510d1..5829394b415 100644 --- a/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/pipeline/DataSinkFactory.java +++ b/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/pipeline/DataSinkFactory.java @@ -30,16 +30,6 @@ public interface DataSinkFactory { */ String supportedType(); - /** - * Returns true if this factory can create a {@link DataSink} for the request. - * - * @deprecated please use {@link #supportedType()} instead. - */ - @Deprecated(since = "0.6.2") - default boolean canHandle(DataFlowStartMessage request) { - return false; - } - /** * Creates a sink to send data to. */ diff --git a/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/pipeline/DataSourceFactory.java b/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/pipeline/DataSourceFactory.java index 478c8319354..9bc0a4897a5 100644 --- a/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/pipeline/DataSourceFactory.java +++ b/spi/data-plane/data-plane-spi/src/main/java/org/eclipse/edc/connector/dataplane/spi/pipeline/DataSourceFactory.java @@ -30,16 +30,6 @@ public interface DataSourceFactory { */ String supportedType(); - /** - * Returns true if this factory can create a {@link DataSource} for the request. - * - * @deprecated please use {@link #supportedType()} instead. - */ - @Deprecated(since = "0.6.2") - default boolean canHandle(DataFlowStartMessage request) { - return false; - } - /** * Creates a source to access data to be sent. */ diff --git a/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferEndToEndParticipant.java b/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferEndToEndParticipant.java index ac6a359552a..16314490662 100644 --- a/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferEndToEndParticipant.java +++ b/system-tests/e2e-transfer-test/runner/src/test/java/org/eclipse/edc/test/e2e/TransferEndToEndParticipant.java @@ -15,7 +15,6 @@ package org.eclipse.edc.test.e2e; import io.restassured.common.mapper.TypeRef; -import jakarta.json.Json; import org.assertj.core.api.ThrowingConsumer; import org.eclipse.edc.connector.controlplane.test.system.utils.Participant; import org.eclipse.edc.spi.types.domain.DataAddress; @@ -24,20 +23,12 @@ import java.net.URI; import java.util.HashMap; import java.util.Map; -import java.util.Set; -import java.util.UUID; import static io.restassured.RestAssured.given; import static io.restassured.http.ContentType.JSON; -import static jakarta.json.Json.createArrayBuilder; -import static jakarta.json.Json.createObjectBuilder; import static java.io.File.separator; import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.boot.BootServicesExtension.PARTICIPANT_ID; -import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.CONTEXT; -import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; -import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE; -import static org.eclipse.edc.spi.constants.CoreConstants.EDC_PREFIX; import static org.eclipse.edc.sql.testfixtures.PostgresqlEndToEndInstance.defaultDatasourceConfiguration; import static org.eclipse.edc.util.io.Ports.getFreePort; @@ -58,46 +49,6 @@ public int getHttpProvisionerPort() { return httpProvisionerPort; } - /** - * Register a data plane using with input transfer type using the data plane signaling API url - * - * @deprecated dataplane now can register itself. - */ - @Deprecated(since = "0.6.3") - public void registerDataPlane(Set transferTypes) { - registerDataPlane(dataPlaneControl + "/v1/dataflows", Set.of("HttpData", "HttpProvision", "Kafka"), Set.of("HttpData", "HttpProvision", "HttpProxy", "Kafka"), transferTypes); - } - - /** - * Register a data plane - * - * @param url The url of the data plane - * @param sources The allowed source types - * @param destinations The allowed destination types - * @param transferTypes The allowed transfer types - * @deprecated dataplane now can register itself. - */ - @Deprecated(since = "0.6.3") - public void registerDataPlane(String url, Set sources, Set destinations, Set transferTypes) { - var jsonObject = Json.createObjectBuilder() - .add(CONTEXT, createObjectBuilder().add(EDC_PREFIX, EDC_NAMESPACE)) - .add(ID, UUID.randomUUID().toString()) - .add(EDC_NAMESPACE + "url", url) - .add(EDC_NAMESPACE + "allowedSourceTypes", createArrayBuilder(sources)) - .add(EDC_NAMESPACE + "allowedDestTypes", createArrayBuilder(destinations)) - .add(EDC_NAMESPACE + "allowedTransferTypes", createArrayBuilder(transferTypes)) - .add(EDC_NAMESPACE + "properties", createObjectBuilder().add("publicApiUrl", dataPlanePublic.toString())) - .build(); - - managementEndpoint.baseRequest() - .contentType(JSON) - .body(jsonObject.toString()) - .when() - .post("/v2/dataplanes") - .then() - .statusCode(200); - } - public Map controlPlaneConfiguration() { return new HashMap<>() { {