Skip to content

Commit

Permalink
chore: change all IATP references to DCP (#370)
Browse files Browse the repository at this point in the history
* chore: change all IATP references to DCP

* update DEPENDENCIES file

* correct a copy & paste error
  • Loading branch information
mspiekermann authored Jun 14, 2024
1 parent 0e59f0c commit 2be366c
Show file tree
Hide file tree
Showing 18 changed files with 99 additions and 99 deletions.
2 changes: 1 addition & 1 deletion DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ maven/mavencentral/com.jcraft/jzlib/1.1.3, BSD-2-Clause, approved, CQ6218
maven/mavencentral/com.lmax/disruptor/3.4.4, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.networknt/json-schema-validator/1.0.76, Apache-2.0, approved, CQ22638
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.28, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.40, , restricted, clearlydefined
maven/mavencentral/com.nimbusds/nimbus-jose-jwt/9.40, Apache-2.0, approved, #15156
maven/mavencentral/com.puppycrawl.tools/checkstyle/10.17.0, LGPL-2.1-or-later AND (Apache-2.0 AND LGPL-2.1-or-later) AND Apache-2.0, approved, #15077
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
Expand Down
2 changes: 1 addition & 1 deletion core/identity-hub-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies {
implementation(project(":core:lib:verifiable-presentation-lib"))
implementation(project(":core:lib:accesstoken-lib"))
implementation(project(":core:lib:credential-query-lib"))
implementation(libs.edc.spi.iatp) //SignatureSuiteRegistry
implementation(libs.edc.spi.dcp) //SignatureSuiteRegistry
implementation(libs.edc.core.connector) // for the CriterionToPredicateConverterImpl
implementation(libs.edc.ext.jsonld) // for the JSON-LD mapper
implementation(libs.edc.lib.util)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@

import static org.eclipse.edc.identityhub.DefaultServicesExtension.NAME;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.ACCESS_TOKEN_SCOPE_CLAIM;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.IATP_ACCESS_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.IATP_SELF_ISSUED_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.DCP_ACCESS_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.DCP_SELF_ISSUED_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.TOKEN_CLAIM;

@Extension(NAME)
Expand All @@ -64,10 +64,10 @@ public String name() {
@Override
public void initialize(ServiceExtensionContext context) {
var accessTokenRule = new ClaimIsPresentRule(TOKEN_CLAIM);
registry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, accessTokenRule);
registry.addRule(DCP_SELF_ISSUED_TOKEN_CONTEXT, accessTokenRule);

var scopeIsPresentRule = new ClaimIsPresentRule(ACCESS_TOKEN_SCOPE_CLAIM);
registry.addRule(IATP_ACCESS_TOKEN_CONTEXT, scopeIsPresentRule);
registry.addRule(DCP_ACCESS_TOKEN_CONTEXT, scopeIsPresentRule);
}

@Provider(isDefault = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import java.net.URISyntaxException;
import java.time.Clock;

import static org.eclipse.edc.iam.identitytrust.spi.IatpConstants.IATP_CONTEXT_URL;
import static org.eclipse.edc.iam.identitytrust.spi.DcpConstants.DCP_CONTEXT_URL;
import static org.eclipse.edc.identityhub.core.CoreServicesExtension.NAME;
import static org.eclipse.edc.identityhub.spi.model.IdentityHubConstants.DID_CONTEXT_URL;
import static org.eclipse.edc.identityhub.spi.model.IdentityHubConstants.JWS_2020_URL;
Expand All @@ -76,7 +76,7 @@ public class CoreServicesExtension implements ServiceExtension {
public static final String NAME = "IdentityHub Core Services Extension";

public static final String PRESENTATION_EXCHANGE_V_1_JSON = "presentation-exchange.v1.json";
public static final String PRESENTATION_QUERY_V_08_JSON = "iatp.v08.json";
public static final String PRESENTATION_QUERY_V_08_JSON = "dcp.v08.json";
public static final String PRESENTATION_SUBMISSION_V1_JSON = "presentation-submission.v1.json";
public static final String DID_JSON = "did.json";
public static final String JWS_2020_JSON = "jws2020.json";
Expand Down Expand Up @@ -172,7 +172,7 @@ public CredentialStatusCheckService createStatusCheckService() {
private void cacheContextDocuments(ClassLoader classLoader) {
try {
jsonLd.registerCachedDocument(PRESENTATION_EXCHANGE_URL, classLoader.getResource(PRESENTATION_EXCHANGE_V_1_JSON).toURI());
jsonLd.registerCachedDocument(IATP_CONTEXT_URL, classLoader.getResource(PRESENTATION_QUERY_V_08_JSON).toURI());
jsonLd.registerCachedDocument(DCP_CONTEXT_URL, classLoader.getResource(PRESENTATION_QUERY_V_08_JSON).toURI());
jsonLd.registerCachedDocument(DID_CONTEXT_URL, classLoader.getResource(DID_JSON).toURI());
jsonLd.registerCachedDocument(JWS_2020_URL, classLoader.getResource(JWS_2020_JSON).toURI());
jsonLd.registerCachedDocument(W3C_CREDENTIALS_URL, classLoader.getResource(CREDENTIALS_V_1_JSON).toURI());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,124 +2,124 @@
"@context": {
"@version": 1.1,
"@protected": true,
"iatp": "https://w3id.org/tractusx-trust/v0.8/",
"dcp": "https://w3id.org/tractusx-trust/v0.8/",
"cred": "https://www.w3.org/2018/credentials/",
"xsd": "http://www.w3.org/2001/XMLSchema/",
"CredentialContainer": {
"@id": "iatp:CredentialContainer",
"@id": "dcp:CredentialContainer",
"@context": {
"payload": {
"@id": "iatp:payload",
"@id": "dcp:payload",
"@type": "xsd:string"
}
}
},
"CredentialMessage": {
"@id": "iatp:CredentialMessage",
"@id": "dcp:CredentialMessage",
"@context": {
"credentials": "iatp:credentials"
"credentials": "dcp:credentials"
}
},
"CredentialObject": {
"@id": "iatp:CredentialObject",
"@id": "dcp:CredentialObject",
"@context": {
"credentialType": {
"@id": "iatp:credentialType",
"@id": "dcp:credentialType",
"@container": "@set"
},
"format": "iatp:format",
"format": "dcp:format",
"offerReason": {
"@id": "iatp:offerReason",
"@id": "dcp:offerReason",
"@type": "xsd:string"
},
"bindingMethods": {
"@id": "iatp:bindingMethods",
"@id": "dcp:bindingMethods",
"@type": "xsd:string",
"@container": "@set"
},
"cryptographicSuites": {
"@id": "iatp:cryptographicSuites",
"@id": "dcp:cryptographicSuites",
"@type": "xsd:string",
"@container": "@set"
},
"issuancePolicy": "iatp:issuancePolicy"
"issuancePolicy": "dcp:issuancePolicy"
}
},
"CredentialOfferMessage": {
"@id": "iatp:CredentialOfferMessage",
"@id": "dcp:CredentialOfferMessage",
"@context": {
"credentialIssuer": "cred:issuer",
"credentials": "iatp:credentials"
"credentials": "dcp:credentials"
}
},
"CredentialRequestMessage": {
"@id": "iatp:CredentialRequestMessage",
"@id": "dcp:CredentialRequestMessage",
"@context": {
"format": "iatp:format",
"format": "dcp:format",
"type": "@type"
}
},
"CredentialService": "iatp:CredentialService",
"CredentialService": "dcp:CredentialService",
"CredentialStatus": {
"@id": "iatp:CredentialStatus",
"@id": "dcp:CredentialStatus",
"@context": {
"requestId": {
"@id": "iatp:requestId",
"@id": "dcp:requestId",
"@type": "@id"
},
"status": {
"@id": "iatp:status",
"@id": "dcp:status",
"@type": "xsd:string"
}
}
},
"IssuerMetadata": {
"@id": "iatp:IssuerMetadata",
"@id": "dcp:IssuerMetadata",
"@context": {
"credentialIssuer": "cred:issuer",
"credentialsSupported": {
"@id": "iatp:credentialsSupported",
"@id": "dcp:credentialsSupported",
"@container": "@set"
}
}
},
"PresentationQueryMessage": {
"@id": "iatp:PresentationQueryMessage",
"@id": "dcp:PresentationQueryMessage",
"@context": {
"presentationDefinition": {
"@id": "iatp:presentationDefinition",
"@id": "dcp:presentationDefinition",
"@type": "@json"
},
"scope": {
"@id": "iatp:scope",
"@id": "dcp:scope",
"@type": "xsd:string",
"@container": "@set"
}
}
},
"PresentationResponseMessage": {
"@id": "iatp:PresentationResponseMessage",
"@id": "dcp:PresentationResponseMessage",
"@context": {
"presentation": {
"@id": "iatp:presentation",
"@id": "dcp:presentation",
"@type": "@json"
},
"presentationSubmission": {
"@id": "iatp:presentationSubmission",
"@id": "dcp:presentationSubmission",
"@type": "@json"
}
}
},
"credentials": {
"@id": "iatp:credentials",
"@id": "dcp:credentials",
"@container": "@set"
},
"credentialSubject": {
"@id": "iatp:credentialSubject",
"@id": "dcp:credentialSubject",
"@type": "cred:credentialSubject"
},
"format": {
"@id": "iatp:format",
"@id": "dcp:format",
"@type": "xsd:string"
},
"type": "@type"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void setUp(ServiceExtensionContext context) {
@Test
void initialize_verifyTokenRules(DefaultServicesExtension extension, ServiceExtensionContext context) {
extension.initialize(context);
verify(registry).addRule(eq("iatp-si"), isA(ClaimIsPresentRule.class));
verify(registry).addRule(eq("iatp-access-token"), isA(ClaimIsPresentRule.class));
verify(registry).addRule(eq("dcp-si"), isA(ClaimIsPresentRule.class));
verify(registry).addRule(eq("dcp-access-token"), isA(ClaimIsPresentRule.class));
verifyNoMoreInteractions(registry);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
package org.eclipse.edc.identityhub.accesstoken.verification;

public interface AccessTokenConstants {
String IATP_SELF_ISSUED_TOKEN_CONTEXT = "iatp-si";
String IATP_ACCESS_TOKEN_CONTEXT = "iatp-access-token";
String DCP_SELF_ISSUED_TOKEN_CONTEXT = "dcp-si";
String DCP_ACCESS_TOKEN_CONTEXT = "dcp-access-token";
String TOKEN_CLAIM = "token";
String ACCESS_TOKEN_SCOPE_CLAIM = "scope";
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import java.util.Objects;

import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.ACCESS_TOKEN_SCOPE_CLAIM;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.IATP_ACCESS_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.IATP_SELF_ISSUED_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.DCP_ACCESS_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.DCP_SELF_ISSUED_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.TOKEN_CLAIM;

/**
Expand Down Expand Up @@ -63,7 +63,7 @@ public AccessTokenVerifierImpl(TokenValidationService tokenValidationService, Ke
@Override
public Result<List<String>> verify(String token, String participantId) {
Objects.requireNonNull(participantId, "Participant ID is mandatory.");
var res = tokenValidationService.validate(token, publicKeyResolver, tokenValidationRulesRegistry.getRules(IATP_SELF_ISSUED_TOKEN_CONTEXT));
var res = tokenValidationService.validate(token, publicKeyResolver, tokenValidationRulesRegistry.getRules(DCP_SELF_ISSUED_TOKEN_CONTEXT));
if (res.failed()) {
return res.mapFailure();
}
Expand Down Expand Up @@ -99,7 +99,7 @@ public Result<List<String>> verify(String token, String participantId) {
};

// verify the correctness of the 'access_token'
var rules = new ArrayList<>(tokenValidationRulesRegistry.getRules(IATP_ACCESS_TOKEN_CONTEXT));
var rules = new ArrayList<>(tokenValidationRulesRegistry.getRules(DCP_ACCESS_TOKEN_CONTEXT));
rules.add(subClaimsMatch);
rules.add(audMustMatchParticipantIdRule);
// todo: verify that the resolved public key belongs to the participant ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
import java.util.UUID;

import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.ACCESS_TOKEN_SCOPE_CLAIM;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.IATP_ACCESS_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.IATP_SELF_ISSUED_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.DCP_ACCESS_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.DCP_SELF_ISSUED_TOKEN_CONTEXT;
import static org.eclipse.edc.identityhub.accesstoken.verification.AccessTokenConstants.TOKEN_CLAIM;
import static org.eclipse.edc.junit.assertions.AbstractResultAssert.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
Expand Down Expand Up @@ -79,10 +79,10 @@ void setUp() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException

// would normally get registered in an extension.
var accessTokenRule = new ClaimIsPresentRule(TOKEN_CLAIM);
ruleRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, accessTokenRule);
ruleRegistry.addRule(DCP_SELF_ISSUED_TOKEN_CONTEXT, accessTokenRule);

var scopeIsPresentRule = new ClaimIsPresentRule(ACCESS_TOKEN_SCOPE_CLAIM);
ruleRegistry.addRule(IATP_ACCESS_TOKEN_CONTEXT, scopeIsPresentRule);
ruleRegistry.addRule(DCP_ACCESS_TOKEN_CONTEXT, scopeIsPresentRule);

var resolverMock = mock(KeyPairResourcePublicKeyResolver.class);
when(resolverMock.resolveKey(anyString(), anyString())).thenReturn(Result.success(stsKeyPair.getPublic()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.eclipse.edc.identithub.verifiablepresentation.generators;

import org.eclipse.edc.iam.identitytrust.spi.IatpConstants;
import org.eclipse.edc.iam.identitytrust.spi.DcpConstants;
import org.eclipse.edc.iam.verifiablecredentials.spi.VcConstants;
import org.eclipse.edc.iam.verifiablecredentials.spi.model.VerifiableCredentialContainer;
import org.eclipse.edc.identityhub.spi.verifiablecredentials.generator.PresentationGenerator;
Expand Down Expand Up @@ -122,7 +122,7 @@ private TokenDecorator vpDecorator(List<String> rawVcs, String issuerId) {

private Map<String, Object> createVpClaim(List<String> rawVcs) {
return Map.of(
JsonLdKeywords.CONTEXT, List.of(IatpConstants.IATP_CONTEXT_URL, VcConstants.W3C_CREDENTIALS_URL, VcConstants.PRESENTATION_EXCHANGE_URL),
JsonLdKeywords.CONTEXT, List.of(DcpConstants.DCP_CONTEXT_URL, VcConstants.W3C_CREDENTIALS_URL, VcConstants.PRESENTATION_EXCHANGE_URL),
VP_TYPE_PROPERTY, VcConstants.VERIFIABLE_PRESENTATION_TYPE,
VERIFIABLE_CREDENTIAL_PROPERTY, rawVcs
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import jakarta.json.JsonArray;
import jakarta.json.JsonArrayBuilder;
import jakarta.json.JsonObject;
import org.eclipse.edc.iam.identitytrust.spi.IatpConstants;
import org.eclipse.edc.iam.identitytrust.spi.DcpConstants;
import org.eclipse.edc.iam.identitytrust.spi.verification.SignatureSuiteRegistry;
import org.eclipse.edc.iam.verifiablecredentials.spi.VcConstants;
import org.eclipse.edc.iam.verifiablecredentials.spi.model.CredentialFormat;
Expand Down Expand Up @@ -128,7 +128,7 @@ public JsonObject generatePresentation(List<VerifiableCredentialContainer> crede
var types = (List) additionalData.get(TYPE_ADDITIONAL_DATA);
var presentationObject = Json.createObjectBuilder()
.add(JsonLdKeywords.CONTEXT, stringArray(List.of(VcConstants.W3C_CREDENTIALS_URL, VcConstants.PRESENTATION_EXCHANGE_URL)))
.add(ID_PROPERTY, IatpConstants.IATP_CONTEXT_URL + "/id/" + UUID.randomUUID())
.add(ID_PROPERTY, DcpConstants.DCP_CONTEXT_URL + "/id/" + UUID.randomUUID())
.add(VP_TYPE_PROPERTY, stringArray(types))
.add(HOLDER_PROPERTY, issuerId)
.add(VERIFIABLE_CREDENTIAL_PROPERTY, toJsonArray(credentials))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.eclipse.edc.iam.identitytrust.spi.IatpConstants.IATP_CONTEXT_URL;
import static org.eclipse.edc.iam.identitytrust.spi.DcpConstants.DCP_CONTEXT_URL;
import static org.eclipse.edc.identityhub.spi.model.IdentityHubConstants.DID_CONTEXT_URL;
import static org.eclipse.edc.identityhub.spi.model.IdentityHubConstants.JWS_2020_URL;
import static org.eclipse.edc.identityhub.spi.model.IdentityHubConstants.PRESENTATION_EXCHANGE_URL;
Expand Down Expand Up @@ -159,7 +159,7 @@ private TitaniumJsonLd initializeJsonLd() {
jld.registerCachedDocument(DID_CONTEXT_URL, TestUtils.getResource("did.json"));
jld.registerCachedDocument(JWS_2020_URL, TestUtils.getResource("jws2020.json"));
jld.registerCachedDocument(W3C_CREDENTIALS_URL, TestUtils.getResource("credentials.v1.json"));
jld.registerCachedDocument(IATP_CONTEXT_URL, TestUtils.getResource("iatp.v08.json"));
jld.registerCachedDocument(DCP_CONTEXT_URL, TestUtils.getResource("dcp.v08.json"));
jld.registerCachedDocument(PRESENTATION_EXCHANGE_URL, TestUtils.getResource("presentation-exchange.v1.json"));
jld.registerCachedDocument("https://www.w3.org/2018/credentials/examples/v1", TestUtils.getResource("examples.v1.json"));
return jld;
Expand Down
Loading

0 comments on commit 2be366c

Please sign in to comment.