Skip to content

Commit

Permalink
build: create Credentials Verifier Maven artifact (#13)
Browse files Browse the repository at this point in the history
* Feature/21/21 verifier maven (#34)

* checkstyle
  • Loading branch information
algattik authored Jul 29, 2022
1 parent 7c6908f commit 7623480
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
11 changes: 10 additions & 1 deletion extensions/identity-hub-verifier/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,13 @@ dependencies {
testImplementation("${edcGroup}:junit:${edcVersion}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${jupiterVersion}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${jupiterVersion}")
}
}

publishing {
publications {
create<MavenPublication>("identity-hub-credentials-verifier") {
artifactId = "identity-hub-credentials-verifier"
from(components["java"])
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import org.eclipse.dataspaceconnector.iam.did.spi.resolution.DidPublicKeyResolver;
import org.eclipse.dataspaceconnector.identityhub.client.IdentityHubClientImpl;
import org.eclipse.dataspaceconnector.identityhub.credentials.VerifiableCredentialsJwtServiceImpl;
import org.eclipse.dataspaceconnector.spi.EdcException;
import org.eclipse.dataspaceconnector.spi.EdcSetting;
import org.eclipse.dataspaceconnector.spi.monitor.Monitor;
import org.eclipse.dataspaceconnector.spi.system.Inject;
import org.eclipse.dataspaceconnector.spi.system.Provider;
Expand All @@ -29,17 +27,12 @@
import org.eclipse.dataspaceconnector.spi.system.ServiceExtensionContext;
import org.eclipse.dataspaceconnector.spi.types.TypeManager;

import static java.lang.String.format;

/**
* Extension to provide verification of IdentityHub Verifiable Credentials.
*/
@Requires({ DidPublicKeyResolver.class })
public class CredentialsVerifierExtension implements ServiceExtension {

@EdcSetting
private static final String HUB_URL_SETTING = "edc.identity.hub.url";

@Inject
private OkHttpClient httpClient;

Expand Down Expand Up @@ -71,11 +64,6 @@ public JwtCredentialsVerifier createJwtVerifier(ServiceExtensionContext context)

@Provider
public CredentialsVerifier createCredentialsVerifier(ServiceExtensionContext context) {
var hubUrl = context.getSetting(HUB_URL_SETTING, null);
if (hubUrl == null) {
throw new EdcException(format("Mandatory setting '(%s)' missing", HUB_URL_SETTING));
}

var client = new IdentityHubClientImpl(httpClient, typeManager.getMapper(), monitor);
var verifiableCredentialsJwtService = new VerifiableCredentialsJwtServiceImpl(typeManager.getMapper());
return new IdentityHubCredentialsVerifier(client, monitor, jwtCredentialsVerifier, verifiableCredentialsJwtService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void setUp(EdcExtension extension) {
identityHubClient = new IdentityHubClientImpl(TestUtils.testOkHttpClient(), new ObjectMapper(), new ConsoleMonitor());
publicKeyResolver = mock(DidPublicKeyResolverImpl.class);
extension.registerServiceMock(DidPublicKeyResolver.class, publicKeyResolver);
extension.setConfiguration(Map.of("web.http.port", String.valueOf(PORT), "edc.identity.hub.url", API_URL));
extension.setConfiguration(Map.of("web.http.port", String.valueOf(PORT)));
}

@Test
Expand Down

0 comments on commit 7623480

Please sign in to comment.