Search in sources :

Example 1 with ServiceExtension

use of org.eclipse.dataspaceconnector.spi.system.ServiceExtension in project edc-showcase by microsoft.

the class TestExtensions method identityServiceExtension.

public static ServiceExtension identityServiceExtension() {
    return new ServiceExtension() {

        @Override
        public Set<String> provides() {
            return Set.of(IdentityService.FEATURE);
        }

        @Override
        public Set<String> requires() {
            return Set.of(VerifiableCredentialProvider.FEATURE, IonClient.FEATURE, IdentityHubClient.FEATURE, DidPublicKeyResolver.FEATURE);
        }

        @Override
        public void initialize(ServiceExtensionContext context) {
            var verifiableCredentialProvider = context.getService(VerifiableCredentialProvider.class);
            var ionClient = context.getService(IonClient.class);
            var idHubclient = context.getService(IdentityHubClient.class);
            DidPublicKeyResolver publicKeyResolver = context.getService(DidPublicKeyResolver.class);
            var resolverRegistry = new DidResolverRegistryImpl();
            var identityService = new DistributedIdentityService(verifiableCredentialProvider, ionClient, new IdentityHubCredentialsVerifier(idHubclient, MONITOR, "did:ion:test"), MONITOR);
            context.registerService(IdentityService.class, identityService);
        }
    };
}
Also used : DistributedIdentityService(org.eclipse.dataspaceconnector.identity.DistributedIdentityService) ServiceExtension(org.eclipse.dataspaceconnector.spi.system.ServiceExtension) IdentityHubCredentialsVerifier(org.eclipse.dataspaceconnector.iam.did.credentials.IdentityHubCredentialsVerifier) DidResolverRegistryImpl(org.eclipse.dataspaceconnector.iam.did.resolution.DidResolverRegistryImpl) ServiceExtensionContext(org.eclipse.dataspaceconnector.spi.system.ServiceExtensionContext) DidPublicKeyResolver(org.eclipse.dataspaceconnector.iam.did.spi.resolution.DidPublicKeyResolver) DefaultDidPublicKeyResolver(org.eclipse.dataspaceconnector.iam.did.resolution.DefaultDidPublicKeyResolver)

Example 2 with ServiceExtension

use of org.eclipse.dataspaceconnector.spi.system.ServiceExtension in project edc-showcase by microsoft.

the class TestExtensions method keyResolvers.

public static ServiceExtension keyResolvers(PrivateKeyResolver privateKeyResolver) {
    return new ServiceExtension() {

        @Override
        public Set<String> provides() {
            return Set.of(DidPublicKeyResolver.FEATURE);
        }

        @Override
        public Set<String> requires() {
            return Set.of(IonClient.FEATURE);
        }

        @Override
        public void initialize(ServiceExtensionContext context) {
            var ionClient = context.getService(IonClient.class);
            context.registerService(PrivateKeyResolver.class, privateKeyResolver);
            context.registerService(DidPublicKeyResolver.class, new DefaultDidPublicKeyResolver(ionClient));
        }
    };
}
Also used : ServiceExtension(org.eclipse.dataspaceconnector.spi.system.ServiceExtension) ServiceExtensionContext(org.eclipse.dataspaceconnector.spi.system.ServiceExtensionContext) DefaultDidPublicKeyResolver(org.eclipse.dataspaceconnector.iam.did.resolution.DefaultDidPublicKeyResolver)

Example 3 with ServiceExtension

use of org.eclipse.dataspaceconnector.spi.system.ServiceExtension in project DataSpaceConnector by eclipse-dataspaceconnector.

the class StartPhaseTest method start.

@Test
void start() {
    ServiceExtension extension = mock(ServiceExtension.class);
    var rp = new StartPhase(new Phase(injector, container, context, monitor) {
    });
    when(container.getInjectionTarget()).thenReturn(extension);
    rp.start();
    verify(extension).start();
    verify(extension).name();
    verifyNoMoreInteractions(extension);
}
Also used : ServiceExtension(org.eclipse.dataspaceconnector.spi.system.ServiceExtension) Test(org.junit.jupiter.api.Test)

Example 4 with ServiceExtension

use of org.eclipse.dataspaceconnector.spi.system.ServiceExtension in project DataSpaceConnector by eclipse-dataspaceconnector.

the class HttpProvisionerExtensionEndToEndTest method setup.

@BeforeEach
void setup(EdcExtension extension) {
    extension.setConfiguration(Map.of("web.http.data.port", String.valueOf(dataPort), "web.http.data.path", "/api/v1/data"));
    delegate = mock(Interceptor.class);
    var httpClient = testOkHttpClient().newBuilder().addInterceptor(delegate).build();
    extension.registerServiceMock(TransferWaitStrategy.class, () -> 1);
    extension.registerSystemExtension(ServiceExtension.class, new HttpProvisionerExtension(httpClient));
    extension.registerSystemExtension(ServiceExtension.class, new DummyCallbackUrlExtension());
    extension.setConfiguration(PROVISIONER_CONFIG);
    extension.registerSystemExtension(ServiceExtension.class, new ServiceExtension() {

        @Inject
        private AssetLoader // needed for on-demand dependency resolution
        loader;
    });
}
Also used : Inject(org.eclipse.dataspaceconnector.spi.system.Inject) ServiceExtension(org.eclipse.dataspaceconnector.spi.system.ServiceExtension) AssetLoader(org.eclipse.dataspaceconnector.dataloading.AssetLoader) HttpProvisionerExtension(org.eclipse.dataspaceconnector.transfer.provision.http.HttpProvisionerExtension) Interceptor(okhttp3.Interceptor) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with ServiceExtension

use of org.eclipse.dataspaceconnector.spi.system.ServiceExtension in project edc-showcase by microsoft.

the class TestExtensions method identityHubClientExtension.

public static ServiceExtension identityHubClientExtension(IdentityHubClient hubclient) {
    return new ServiceExtension() {

        @Override
        public Set<String> provides() {
            return Set.of(CredentialsVerifier.FEATURE, IdentityHubClient.FEATURE);
        }

        @Override
        public void initialize(ServiceExtensionContext context) {
            context.registerService(CredentialsVerifier.class, new IdentityHubCredentialsVerifier(hubclient, MONITOR, "did:ion:test"));
            context.registerService(IdentityHubClient.class, hubclient);
        }
    };
}
Also used : ServiceExtension(org.eclipse.dataspaceconnector.spi.system.ServiceExtension) IdentityHubCredentialsVerifier(org.eclipse.dataspaceconnector.iam.did.credentials.IdentityHubCredentialsVerifier) ServiceExtensionContext(org.eclipse.dataspaceconnector.spi.system.ServiceExtensionContext)

Aggregations

ServiceExtension (org.eclipse.dataspaceconnector.spi.system.ServiceExtension)5 ServiceExtensionContext (org.eclipse.dataspaceconnector.spi.system.ServiceExtensionContext)3 IdentityHubCredentialsVerifier (org.eclipse.dataspaceconnector.iam.did.credentials.IdentityHubCredentialsVerifier)2 DefaultDidPublicKeyResolver (org.eclipse.dataspaceconnector.iam.did.resolution.DefaultDidPublicKeyResolver)2 Interceptor (okhttp3.Interceptor)1 AssetLoader (org.eclipse.dataspaceconnector.dataloading.AssetLoader)1 DidResolverRegistryImpl (org.eclipse.dataspaceconnector.iam.did.resolution.DidResolverRegistryImpl)1 DidPublicKeyResolver (org.eclipse.dataspaceconnector.iam.did.spi.resolution.DidPublicKeyResolver)1 DistributedIdentityService (org.eclipse.dataspaceconnector.identity.DistributedIdentityService)1 Inject (org.eclipse.dataspaceconnector.spi.system.Inject)1 HttpProvisionerExtension (org.eclipse.dataspaceconnector.transfer.provision.http.HttpProvisionerExtension)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 Test (org.junit.jupiter.api.Test)1