Skip to content

Commit

Permalink
introduce new 'identity' api context instead of 'management'
Browse files Browse the repository at this point in the history
  • Loading branch information
paullatzelsperger committed Jun 4, 2024
1 parent f6b43d5 commit c02f945
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
-v $(pwd)/keys:/opt/keys \
-e "EDC_IH_IAM_PUBLICKEY_PATH=/opt/keys/key.pem" \
-e "EDC_IH_IAM_ID=did:web:test" \
-e "WEB_HTTP_MANAGEMENT_PORT=8182" \
-e "WEB_HTTP_MANAGEMENT_PATH=/api/management" \
-e "WEB_HTTP_IDENTITY_PORT=8182" \
-e "WEB_HTTP_IDENTITY_PATH=/api/management" \
-e "WEB_HTTP_RESOLUTION_PORT=10001" \
-e "WEB_HTTP_RESOLUTION_PATH=/api/v1/resolution/" \
identity-hub:latest
Expand Down
12 changes: 8 additions & 4 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ maven/mavencentral/com.networknt/json-schema-validator/1.0.76, Apache-2.0, appro
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.28, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.39, Apache-2.0, approved, #14830
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.39.3, Apache-2.0, approved, #14830
maven/mavencentral/com.puppycrawl.tools/checkstyle/10.17.0, , restricted, clearlydefined
maven/mavencentral/com.puppycrawl.tools/checkstyle/10.17.0, LGPL-2.1-or-later, restricted, clearlydefined
maven/mavencentral/com.samskivert/jmustache/1.15, BSD-2-Clause, approved, clearlydefined
maven/mavencentral/com.squareup.okhttp3/okhttp-dnsoverhttps/4.12.0, Apache-2.0, approved, #11159
maven/mavencentral/com.squareup.okhttp3/okhttp/4.12.0, Apache-2.0, approved, #11156
Expand Down Expand Up @@ -352,17 +352,21 @@ maven/mavencentral/org.jetbrains/annotations/24.1.0, Apache-2.0, approved, clear
maven/mavencentral/org.junit-pioneer/junit-pioneer/2.2.0, EPL-2.0, approved, #11857
maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.10.1, EPL-2.0, approved, #9714
maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.10.2, EPL-2.0, approved, #9714
maven/mavencentral/org.junit.jupiter/junit-jupiter-api/5.9.2, EPL-2.0, approved, #3133
maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.10.1, EPL-2.0, approved, #9711
maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.10.2, EPL-2.0, approved, #9711
maven/mavencentral/org.junit.jupiter/junit-jupiter-engine/5.9.2, EPL-2.0, approved, #3125
maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.10.1, EPL-2.0, approved, #9708
maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.10.2, EPL-2.0, approved, #9708
maven/mavencentral/org.junit.jupiter/junit-jupiter-params/5.9.2, EPL-2.0, approved, #3134
maven/mavencentral/org.junit.platform/junit-platform-commons/1.10.1, EPL-2.0, approved, #9715
maven/mavencentral/org.junit.platform/junit-platform-commons/1.10.2, EPL-2.0, approved, #9715
maven/mavencentral/org.junit.platform/junit-platform-commons/1.9.2, EPL-2.0, approved, #3130
maven/mavencentral/org.junit.platform/junit-platform-engine/1.10.1, EPL-2.0, approved, #9709
maven/mavencentral/org.junit.platform/junit-platform-engine/1.10.2, EPL-2.0, approved, #9709
maven/mavencentral/org.junit.platform/junit-platform-launcher/1.10.2, EPL-2.0, approved, #9704
maven/mavencentral/org.junit.platform/junit-platform-engine/1.9.2, EPL-2.0, approved, #3128
maven/mavencentral/org.junit.platform/junit-platform-launcher/1.10.1, EPL-2.0, approved, #9704
maven/mavencentral/org.junit.platform/junit-platform-launcher/1.9.2, EPL-2.0, approved, #3132
maven/mavencentral/org.junit/junit-bom/5.10.1, EPL-2.0, approved, #9844
maven/mavencentral/org.junit/junit-bom/5.10.2, EPL-2.0, approved, #9844
maven/mavencentral/org.junit/junit-bom/5.9.2, EPL-2.0, approved, #4711
maven/mavencentral/org.jvnet.mimepull/mimepull/1.9.15, CDDL-1.1 OR GPL-2.0-only WITH Classpath-exception-2.0, approved, CQ21484
maven/mavencentral/org.mock-server/mockserver-client-java/5.15.0, Apache-2.0 AND LGPL-3.0-only, approved, #9324
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

package org.eclipse.edc.identityhub.publickey;

import org.eclipse.edc.identityhub.spi.participantcontext.model.ParticipantResource;
import org.eclipse.edc.identityhub.spi.store.KeyPairResourceStore;
import org.eclipse.edc.keys.LocalPublicKeyServiceImpl;
import org.eclipse.edc.keys.spi.KeyParserRegistry;
import org.eclipse.edc.spi.monitor.Monitor;
import org.eclipse.edc.spi.query.Criterion;
import org.eclipse.edc.spi.query.QuerySpec;
import org.eclipse.edc.spi.result.Result;
import org.eclipse.edc.spi.security.Vault;

Expand Down Expand Up @@ -51,7 +51,8 @@ public Result<PublicKey> resolveKey(String id) {
}

private Result<PublicKey> resolveFromDbOrVault(String publicKeyId) {
var result = keyPairResourceStore.query(QuerySpec.Builder.newInstance().filter(new Criterion("keyId", "=", publicKeyId)).build());
var query = ParticipantResource.queryByParticipantId("").filter(new Criterion("keyId", "=", publicKeyId)).build();
var result = keyPairResourceStore.query(query);
// store failed, e.g. data model does not match query, etc.
if (result.failed()) {
monitor.warning("Error querying database for KeyPairResource with key ID '%s': %s".formatted(publicKeyId, result.getFailureDetail()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public Map<String, String> controlPlaneConfiguration() {
put("web.http.path", "/api/v1");
put("web.http.resolution.port", String.valueOf(resolutionEndpoint.getUrl().getPort()));
put("web.http.resolution.path", resolutionEndpoint.getUrl().getPath());
put("web.http.management.port", String.valueOf(managementEndpoint.getUrl().getPort()));
put("web.http.management.path", managementEndpoint.getUrl().getPath());
put("web.http.identity.port", String.valueOf(managementEndpoint.getUrl().getPort()));
put("web.http.identity.path", managementEndpoint.getUrl().getPath());
put("edc.connector.name", name);
put("edc.ih.iam.publickey.alias", JwtCreationUtil.CONSUMER_KEY.getKeyID());
put("edc.ih.iam.id", "did:web:consumer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public String name() {

@Override
public void initialize(ServiceExtensionContext context) {
var alias = IdentityHubApiContext.IH_MANAGEMENT;
var alias = IdentityHubApiContext.IDENTITY;
webService.registerResource(alias, new RoleBasedAccessFeature());
webService.registerResource(alias, new ServicePrincipalAuthenticationFilter(new ParticipantServicePrincipalResolver(participantContextService, vault)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public void initialize(ServiceExtensionContext context) {
authorizationService.addLookupFunction(DidResource.class, s -> didDocumentService.findById(s));
var controller = new DidManagementApiController(didDocumentService, authorizationService);
var getAllController = new GetAllDidsApiController(didDocumentService);
webService.registerResource(IdentityHubApiContext.IH_MANAGEMENT, controller);
webService.registerResource(IdentityHubApiContext.IH_MANAGEMENT, getAllController);
webService.registerResource(IdentityHubApiContext.IDENTITY, controller);
webService.registerResource(IdentityHubApiContext.IDENTITY, getAllController);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public void initialize(ServiceExtensionContext context) {
authorizationService.addLookupFunction(KeyPairResource.class, this::findById);
var api = new KeyPairResourceApiController(authorizationService, keyPairService, new KeyDescriptorValidator(context.getMonitor()));
var getAllApi = new GetAllKeyPairsApiController(keyPairService);
webService.registerResource(IdentityHubApiContext.IH_MANAGEMENT, api);
webService.registerResource(IdentityHubApiContext.IH_MANAGEMENT, getAllApi);
webService.registerResource(IdentityHubApiContext.IDENTITY, api);
webService.registerResource(IdentityHubApiContext.IDENTITY, getAllApi);
}

private ParticipantResource findById(String keyPairId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ public String name() {
public void initialize(ServiceExtensionContext context) {
authorizationService.addLookupFunction(ParticipantContext.class, s -> participantContextService.getParticipantContext(s).orElseThrow(exceptionMapper(ParticipantContext.class, s)));
var controller = new ParticipantContextApiController(new ParticipantManifestValidator(monitor), participantContextService, authorizationService);
webService.registerResource(IdentityHubApiContext.IH_MANAGEMENT, controller);
webService.registerResource(IdentityHubApiContext.IDENTITY, controller);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public void initialize(ServiceExtensionContext context) {
authorizationService.addLookupFunction(VerifiableCredentialResource.class, this::queryById);
var controller = new VerifiableCredentialsApiController(credentialStore, authorizationService);
var getAllController = new GetAllCredentialsApiController(credentialStore);
webService.registerResource(IdentityHubApiContext.IH_MANAGEMENT, controller);
webService.registerResource(IdentityHubApiContext.IH_MANAGEMENT, getAllController);
webService.registerResource(IdentityHubApiContext.IDENTITY, controller);
webService.registerResource(IdentityHubApiContext.IDENTITY, getAllController);
}

private ParticipantResource queryById(String credentialId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
package org.eclipse.edc.identityhub.spi;

public interface IdentityHubApiContext {
String IH_MANAGEMENT = "management";
String IDENTITY = "identity";
String IH_DID = "did";
}

0 comments on commit c02f945

Please sign in to comment.