Custom Policy Evaluation Function Not Triggered in EDC MVD Setup #489
Unanswered
Zhipeng-lin1
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm experimenting with how
PolicyEnforcementworks in EDC (using the MVD base project) by creating a custom policy evaluation function tied to a new constraint (ParticipantCredential). Here's a breakdown of what I’ve done:🔧 Modifications in
PolicyEvaluationExtension.javaI removed unnecessary default bindings and replaced them with my own:
🧩 Adjustments in DcpPatchExtension.java
I registered my trusted issuers and set the default scope mapping:
🧠 Custom Evaluation Function
I implemented a custom evaluation function as follows:
📜 Verifiable Credential (VC) Sample
Here's an example of the ParticipantCredential I used:
{ "@context": [...], "type": ["VerifiableCredential", "ParticipantCredential"], "issuer": "did:web:example-issuer.com", "credentialSubject": { "id": "did:web:localhost:7083", "type": "gx:LegalParticipant", "gx:legalName": "Example Org", ... }, "proof": { "type": "JsonWebSignature2020", "proofPurpose": "assertionMethod", "verificationMethod": "did:web:example-issuer.com#key-1", "jws": "eyJhbGciOiJQUzI1NiIsIm..." } }❗ Problem
After defining assets, a policy, and a contract definition using this constraint key, the evaluation function is never triggered. I confirmed this by running the project locally in IntelliJ with breakpoints.
Assets:
{ "@context": [ "https://w3id.org/edc/connector/management/v0.0.1" ], "@id": "asset-3", "@type": "Asset", "properties": { "description": "This asset requires Participant to view and negotiate." }, "dataAddress": { "@type": "DataAddress", "type": "HttpData", "baseUrl": "https://jsonplaceholder.typicode.com/todos", "proxyPath": "true", "proxyQueryParams": "true" } }Policy:
{ "@context": [ "https://w3id.org/edc/connector/management/v0.0.1" ], "@type": "PolicyDefinition", "@id": "require-participant", "policy": { "@type": "Set", "permission": [ { "action": "use", "constraint": { "leftOperand": "ParticipantCredential", "operator": "eq", "rightOperand": "active" } } ] } }Contract Definition:
Even when the consumer does not have the ParticipantCredential VC seeded into the Identity Hub, the asset still appears in the catalog and no evaluation occurs.
Questions
Beta Was this translation helpful? Give feedback.
All reactions