Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change all IATP references to DCP #4237

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
*/
public class JwtPresentationVerifier implements CredentialVerifier {

public static final String JWT_VC_TOKEN_CONTEXT = "iatp-vc";
public static final String JWT_VP_TOKEN_CONTEXT = "iatp-vp";
public static final String JWT_VC_TOKEN_CONTEXT = "dcp-vc";
public static final String JWT_VP_TOKEN_CONTEXT = "dcp-vp";
public static final String VERIFIABLE_CREDENTIAL_JSON_KEY = "verifiableCredential";
public static final String VP_CLAIM = "vp";
public static final String VC_CLAIM = "vc";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

package org.eclipse.edc.iam.identitytrust.core;

import org.eclipse.edc.iam.identitytrust.core.defaults.DefaultIatpParticipantAgentServiceExtension;
import org.eclipse.edc.iam.identitytrust.core.defaults.DefaultDcpParticipantAgentServiceExtension;
import org.eclipse.edc.iam.identitytrust.core.defaults.DefaultTrustedIssuerRegistry;
import org.eclipse.edc.iam.identitytrust.core.defaults.InMemorySignatureSuiteRegistry;
import org.eclipse.edc.iam.identitytrust.core.scope.IatpScopeExtractorRegistry;
import org.eclipse.edc.iam.identitytrust.core.scope.DcpScopeExtractorRegistry;
import org.eclipse.edc.iam.identitytrust.spi.ClaimTokenCreatorFunction;
import org.eclipse.edc.iam.identitytrust.spi.IatpParticipantAgentServiceExtension;
import org.eclipse.edc.iam.identitytrust.spi.DcpParticipantAgentServiceExtension;
import org.eclipse.edc.iam.identitytrust.spi.SecureTokenService;
import org.eclipse.edc.iam.identitytrust.spi.scope.ScopeExtractorRegistry;
import org.eclipse.edc.iam.identitytrust.spi.verification.SignatureSuiteRegistry;
Expand Down Expand Up @@ -48,7 +48,7 @@
import static org.eclipse.edc.spi.result.Result.success;

@Extension("Identity And Trust Extension to register default services")
public class IatpDefaultServicesExtension implements ServiceExtension {
public class DcpDefaultServicesExtension implements ServiceExtension {

@Setting(value = "Alias of private key used for signing tokens, retrieved from private key resolver", defaultValue = "A random EC private key")
public static final String STS_PRIVATE_KEY_ALIAS = "edc.iam.sts.privatekey.alias";
Expand All @@ -57,7 +57,7 @@ public class IatpDefaultServicesExtension implements ServiceExtension {
public static final String CLAIMTOKEN_VC_KEY = "vc";
// not a setting, it's defined in Oauth2ServiceExtension
private static final String OAUTH_TOKENURL_PROPERTY = "edc.oauth.token.url";
@Setting(value = "Self-issued ID Token expiration in minutes. By default is 5 minutes", defaultValue = "" + IatpDefaultServicesExtension.DEFAULT_STS_TOKEN_EXPIRATION_MIN)
@Setting(value = "Self-issued ID Token expiration in minutes. By default is 5 minutes", defaultValue = "" + DcpDefaultServicesExtension.DEFAULT_STS_TOKEN_EXPIRATION_MIN)
private static final String STS_TOKEN_EXPIRATION = "edc.iam.sts.token.expiration"; // in minutes
private static final int DEFAULT_STS_TOKEN_EXPIRATION_MIN = 5;
@Inject
Expand Down Expand Up @@ -95,16 +95,16 @@ public SignatureSuiteRegistry createSignatureSuiteRegistry() {
}

@Provider(isDefault = true)
public IatpParticipantAgentServiceExtension createDefaultIatpParticipantAgentServiceExtension() {
return new DefaultIatpParticipantAgentServiceExtension();
public DcpParticipantAgentServiceExtension createDefaultDcpParticipantAgentServiceExtension() {
return new DefaultDcpParticipantAgentServiceExtension();
}

@Provider(isDefault = true)
public ScopeExtractorRegistry scopeExtractorRegistry() {
return new IatpScopeExtractorRegistry();
return new DcpScopeExtractorRegistry();
}

// Default audience for IATP is the counter-party id
// Default audience for DCP is the counter-party id
@Provider(isDefault = true)
public AudienceResolver defaultAudienceResolver() {
return RemoteMessage::getCounterPartyId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.eclipse.edc.iam.identitytrust.core;

import org.eclipse.edc.iam.identitytrust.core.scope.IatpScopeExtractorFunction;
import org.eclipse.edc.iam.identitytrust.core.scope.DcpScopeExtractorFunction;
import org.eclipse.edc.iam.identitytrust.spi.scope.ScopeExtractorRegistry;
import org.eclipse.edc.policy.engine.spi.PolicyEngine;
import org.eclipse.edc.runtime.metamodel.annotation.Extension;
Expand All @@ -23,12 +23,12 @@
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;

import static org.eclipse.edc.iam.identitytrust.core.IatpScopeExtractorExtension.NAME;
import static org.eclipse.edc.iam.identitytrust.core.DcpScopeExtractorExtension.NAME;

@Extension(NAME)
public class IatpScopeExtractorExtension implements ServiceExtension {
public class DcpScopeExtractorExtension implements ServiceExtension {

public static final String NAME = "IATP scope extractor extension";
public static final String NAME = "DCP scope extractor extension";

public static final String CATALOG_REQUEST_SCOPE = "request.catalog";
public static final String NEGOTIATION_REQUEST_SCOPE = "request.contract.negotiation";
Expand All @@ -50,7 +50,7 @@ public String name() {

@Override
public void initialize(ServiceExtensionContext context) {
var contextMappingFunction = new IatpScopeExtractorFunction(scopeExtractorRegistry, monitor);
var contextMappingFunction = new DcpScopeExtractorFunction(scopeExtractorRegistry, monitor);
policyEngine.registerPreValidator(CATALOG_REQUEST_SCOPE, contextMappingFunction);
policyEngine.registerPreValidator(NEGOTIATION_REQUEST_SCOPE, contextMappingFunction);
policyEngine.registerPreValidator(TRANSFER_PROCESS_REQUEST_SCOPE, contextMappingFunction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.eclipse.edc.iam.identitytrust.service.verification.MultiFormatPresentationVerifier;
import org.eclipse.edc.iam.identitytrust.spi.ClaimTokenCreatorFunction;
import org.eclipse.edc.iam.identitytrust.spi.CredentialServiceClient;
import org.eclipse.edc.iam.identitytrust.spi.IatpParticipantAgentServiceExtension;
import org.eclipse.edc.iam.identitytrust.spi.DcpParticipantAgentServiceExtension;
import org.eclipse.edc.iam.identitytrust.spi.SecureTokenService;
import org.eclipse.edc.iam.identitytrust.spi.validation.TokenValidationAction;
import org.eclipse.edc.iam.identitytrust.spi.verification.SignatureSuiteRegistry;
Expand Down Expand Up @@ -75,7 +75,7 @@ public class IdentityAndTrustExtension implements ServiceExtension {
public static final String REVOCATION_CACHE_VALIDITY = "edc.iam.credential.revocation.cache.validity";
@Setting(value = "DID of this connector", required = true)
public static final String CONNECTOR_DID_PROPERTY = "edc.iam.issuer.id";
public static final String IATP_SELF_ISSUED_TOKEN_CONTEXT = "iatp-si";
public static final String DCP_SELF_ISSUED_TOKEN_CONTEXT = "dcp-si";

public static final String JSON_2020_SIGNATURE_SUITE = "JsonWebSignature2020";

Expand Down Expand Up @@ -121,7 +121,7 @@ public class IdentityAndTrustExtension implements ServiceExtension {
private ParticipantAgentService participantAgentService;

@Inject
private IatpParticipantAgentServiceExtension participantAgentServiceExtension;
private DcpParticipantAgentServiceExtension participantAgentServiceExtension;

private PresentationVerifier presentationVerifier;
private CredentialServiceClient credentialServiceClient;
Expand All @@ -131,13 +131,13 @@ public class IdentityAndTrustExtension implements ServiceExtension {
public void initialize(ServiceExtensionContext context) {

// add all rules for self-issued ID tokens
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new IssuerEqualsSubjectRule());
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new SubJwkIsNullRule());
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new AudienceValidationRule(getOwnDid(context)));
rulesRegistry.addRule(DCP_SELF_ISSUED_TOKEN_CONTEXT, new IssuerEqualsSubjectRule());
rulesRegistry.addRule(DCP_SELF_ISSUED_TOKEN_CONTEXT, new SubJwkIsNullRule());
rulesRegistry.addRule(DCP_SELF_ISSUED_TOKEN_CONTEXT, new AudienceValidationRule(getOwnDid(context)));
context.getMonitor().warning("The JTI Validation rule is not yet implemented as it depends on https://github.com/eclipse-edc/Connector/issues/3749.");
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new JtiValidationRule());
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new ExpirationIssuedAtValidationRule(clock, 5));
rulesRegistry.addRule(IATP_SELF_ISSUED_TOKEN_CONTEXT, new TokenNotNullRule());
rulesRegistry.addRule(DCP_SELF_ISSUED_TOKEN_CONTEXT, new JtiValidationRule());
rulesRegistry.addRule(DCP_SELF_ISSUED_TOKEN_CONTEXT, new ExpirationIssuedAtValidationRule(clock, 5));
rulesRegistry.addRule(DCP_SELF_ISSUED_TOKEN_CONTEXT, new TokenNotNullRule());

// add all rules for validating VerifiableCredential JWTs
rulesRegistry.addRule(JWT_VC_TOKEN_CONTEXT, new HasSubjectRule());
Expand Down Expand Up @@ -206,7 +206,7 @@ public RevocationListService createRevocationListService(ServiceExtensionContext
@NotNull
private TokenValidationAction tokenValidationAction() {
return (tokenRepresentation) -> {
var rules = rulesRegistry.getRules(IATP_SELF_ISSUED_TOKEN_CONTEXT);
var rules = rulesRegistry.getRules(DCP_SELF_ISSUED_TOKEN_CONTEXT);
return tokenValidationService.validate(tokenRepresentation, didPublicKeyResolver, rules);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import java.net.URISyntaxException;

import static java.lang.String.format;
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.spi.constants.CoreConstants.JSON_LD;

@Extension(value = IdentityTrustTransformExtension.NAME, categories = { "iam", "transform", "jsonld" })
Expand All @@ -65,8 +65,8 @@ public void initialize(ServiceExtensionContext context) {
.onSuccess(uri -> jsonLdService.registerCachedDocument("https://www.w3.org/2018/credentials/v1", uri))
.onFailure(failure -> context.getMonitor().warning("Failed to register cached json-ld document: " + failure.getFailureDetail()));

getResourceUri("document" + File.separator + "iatp.v08.jsonld")
.onSuccess(uri -> jsonLdService.registerCachedDocument(IATP_CONTEXT_URL, uri))
getResourceUri("document" + File.separator + "dcp.v08.jsonld")
.onSuccess(uri -> jsonLdService.registerCachedDocument(DCP_CONTEXT_URL, uri))
.onFailure(failure -> context.getMonitor().warning("Failed to register cached json-ld document: " + failure.getFailureDetail()));

typeTransformerRegistry.register(new JsonObjectToPresentationQueryTransformer(typeManager.getMapper(JSON_LD)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import okhttp3.RequestBody;
import org.eclipse.edc.http.spi.EdcHttpClient;
import org.eclipse.edc.iam.identitytrust.spi.CredentialServiceClient;
import org.eclipse.edc.iam.identitytrust.spi.IatpConstants;
import org.eclipse.edc.iam.identitytrust.spi.DcpConstants;
import org.eclipse.edc.iam.identitytrust.spi.model.PresentationQueryMessage;
import org.eclipse.edc.iam.identitytrust.spi.model.PresentationResponseMessage;
import org.eclipse.edc.iam.verifiablecredentials.spi.VcConstants;
Expand Down Expand Up @@ -148,7 +148,7 @@ private JsonObject createPresentationQuery(List<String> scopes) {
return jsonFactory.createObjectBuilder()
.add(JsonLdKeywords.CONTEXT, jsonFactory.createArrayBuilder()
.add(VcConstants.PRESENTATION_EXCHANGE_URL)
.add(IatpConstants.IATP_CONTEXT_URL))
.add(DcpConstants.DCP_CONTEXT_URL))
.add(JsonLdKeywords.TYPE, PresentationQueryMessage.PRESENTATION_QUERY_MESSAGE_TYPE)
.add("scope", scopeArray.build())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package org.eclipse.edc.iam.identitytrust.core.defaults;

import org.eclipse.edc.iam.identitytrust.spi.IatpParticipantAgentServiceExtension;
import org.eclipse.edc.iam.identitytrust.spi.DcpParticipantAgentServiceExtension;
import org.eclipse.edc.iam.verifiablecredentials.spi.model.CredentialSubject;
import org.eclipse.edc.iam.verifiablecredentials.spi.model.VerifiableCredential;
import org.eclipse.edc.spi.iam.ClaimToken;
Expand All @@ -26,14 +26,14 @@
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Optional.ofNullable;
import static org.eclipse.edc.iam.identitytrust.core.IatpDefaultServicesExtension.CLAIMTOKEN_VC_KEY;
import static org.eclipse.edc.iam.identitytrust.core.DcpDefaultServicesExtension.CLAIMTOKEN_VC_KEY;
import static org.eclipse.edc.spi.agent.ParticipantAgent.PARTICIPANT_IDENTITY;

/**
* Retrieve subject id from the list of {@link VerifiableCredential} and set the
* PARTICIPANT_IDENTITY attribute accordingly.
*/
public class DefaultIatpParticipantAgentServiceExtension implements IatpParticipantAgentServiceExtension {
public class DefaultDcpParticipantAgentServiceExtension implements DcpParticipantAgentServiceExtension {
@Override
public @NotNull Map<String, String> attributesFor(ClaimToken token) {
return ofNullable(token.getListClaim(CLAIMTOKEN_VC_KEY)).orElse(emptyList())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
import static java.lang.String.format;

/**
* IATP pre-validator function for extracting scopes from a {@link Policy} using the registered {@link ScopeExtractor}
* DCP pre-validator function for extracting scopes from a {@link Policy} using the registered {@link ScopeExtractor}
* in the {@link ScopeExtractorRegistry}.
*/
public class IatpScopeExtractorFunction implements BiFunction<Policy, PolicyContext, Boolean> {
public class DcpScopeExtractorFunction implements BiFunction<Policy, PolicyContext, Boolean> {

private final ScopeExtractorRegistry registry;
private final Monitor monitor;

public IatpScopeExtractorFunction(ScopeExtractorRegistry registry, Monitor monitor) {
public DcpScopeExtractorFunction(ScopeExtractorRegistry registry, Monitor monitor) {
this.registry = registry;
this.monitor = monitor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.List;
import java.util.Set;

public class IatpScopeExtractorRegistry implements ScopeExtractorRegistry {
public class DcpScopeExtractorRegistry implements ScopeExtractorRegistry {

private final List<ScopeExtractor> extractors = new ArrayList<>();

Expand All @@ -35,7 +35,7 @@ public void registerScopeExtractor(ScopeExtractor extractor) {

@Override
public Result<Set<String>> extractScopes(Policy policy, PolicyContext policyContext) {
var visitor = new IatpScopeExtractorVisitor(extractors, policyContext);
var visitor = new DcpScopeExtractorVisitor(extractors, policyContext);
var policies = policy.accept(visitor);
if (policyContext.hasProblems()) {
return Result.failure(policyContext.getProblems());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
import java.util.stream.Collectors;

/**
* IATP scope visitor for invoking {@link ScopeExtractor}s during the pre-validation phase.
* DCP scope visitor for invoking {@link ScopeExtractor}s during the pre-validation phase.
*/
public class IatpScopeExtractorVisitor implements Policy.Visitor<Set<String>>, Rule.Visitor<Set<String>>, Constraint.Visitor<Set<String>>, Expression.Visitor<Object> {
public class DcpScopeExtractorVisitor implements Policy.Visitor<Set<String>>, Rule.Visitor<Set<String>>, Constraint.Visitor<Set<String>>, Expression.Visitor<Object> {

private final List<ScopeExtractor> mappers;
private final PolicyContext policyContext;

public IatpScopeExtractorVisitor(List<ScopeExtractor> mappers, PolicyContext policyContext) {
public DcpScopeExtractorVisitor(List<ScopeExtractor> mappers, PolicyContext policyContext) {
this.mappers = mappers;
this.policyContext = policyContext;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
#

org.eclipse.edc.iam.identitytrust.core.IatpDefaultServicesExtension
org.eclipse.edc.iam.identitytrust.core.IatpScopeExtractorExtension
org.eclipse.edc.iam.identitytrust.core.DcpDefaultServicesExtension
org.eclipse.edc.iam.identitytrust.core.DcpScopeExtractorExtension
org.eclipse.edc.iam.identitytrust.core.IdentityAndTrustExtension
org.eclipse.edc.iam.identitytrust.core.IdentityTrustTransformExtension
Loading
Loading