diff --git a/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorRegistry.java b/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorRegistry.java index c3bf0777ce6..509a0b0ff11 100644 --- a/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorRegistry.java +++ b/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorRegistry.java @@ -16,7 +16,7 @@ import org.eclipse.edc.iam.identitytrust.spi.scope.ScopeExtractor; import org.eclipse.edc.iam.identitytrust.spi.scope.ScopeExtractorRegistry; -import org.eclipse.edc.policy.engine.spi.PolicyContext; +import org.eclipse.edc.policy.context.request.spi.RequestPolicyContext; import org.eclipse.edc.policy.model.Policy; import org.eclipse.edc.spi.result.Result; @@ -34,7 +34,7 @@ public void registerScopeExtractor(ScopeExtractor extractor) { } @Override - public Result> extractScopes(Policy policy, PolicyContext policyContext) { + public Result> extractScopes(Policy policy, RequestPolicyContext policyContext) { var visitor = new DcpScopeExtractorVisitor(extractors, policyContext); var policies = policy.accept(visitor); if (policyContext.hasProblems()) { diff --git a/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorVisitor.java b/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorVisitor.java index 657ccee3f79..a6167fd4e3b 100644 --- a/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorVisitor.java +++ b/extensions/common/iam/identity-trust/identity-trust-core/src/main/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorVisitor.java @@ -15,7 +15,7 @@ package org.eclipse.edc.iam.identitytrust.core.scope; import org.eclipse.edc.iam.identitytrust.spi.scope.ScopeExtractor; -import org.eclipse.edc.policy.engine.spi.PolicyContext; +import org.eclipse.edc.policy.context.request.spi.RequestPolicyContext; import org.eclipse.edc.policy.model.AndConstraint; import org.eclipse.edc.policy.model.AtomicConstraint; import org.eclipse.edc.policy.model.Constraint; @@ -42,9 +42,9 @@ public class DcpScopeExtractorVisitor implements Policy.Visitor>, Rule.Visitor>, Constraint.Visitor>, Expression.Visitor { private final List mappers; - private final PolicyContext policyContext; + private final RequestPolicyContext policyContext; - public DcpScopeExtractorVisitor(List mappers, PolicyContext policyContext) { + public DcpScopeExtractorVisitor(List mappers, RequestPolicyContext policyContext) { this.mappers = mappers; this.policyContext = policyContext; } diff --git a/extensions/common/iam/identity-trust/identity-trust-core/src/test/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorRegistryTest.java b/extensions/common/iam/identity-trust/identity-trust-core/src/test/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorRegistryTest.java index 9237a6594bf..a30924e3de8 100644 --- a/extensions/common/iam/identity-trust/identity-trust-core/src/test/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorRegistryTest.java +++ b/extensions/common/iam/identity-trust/identity-trust-core/src/test/java/org/eclipse/edc/iam/identitytrust/core/scope/DcpScopeExtractorRegistryTest.java @@ -15,7 +15,7 @@ package org.eclipse.edc.iam.identitytrust.core.scope; import org.eclipse.edc.iam.identitytrust.spi.scope.ScopeExtractor; -import org.eclipse.edc.policy.engine.spi.PolicyContext; +import org.eclipse.edc.policy.context.request.spi.RequestPolicyContext; import org.eclipse.edc.policy.model.Constraint; import org.eclipse.edc.policy.model.Operator; import org.eclipse.edc.policy.model.Policy; @@ -50,14 +50,12 @@ public class DcpScopeExtractorRegistryTest { + private final RequestPolicyContext ctx = mock(); + private final ScopeExtractor extractor = mock(); private final DcpScopeExtractorRegistry registry = new DcpScopeExtractorRegistry(); - private ScopeExtractor extractor; - private PolicyContext ctx; @BeforeEach void setup() { - extractor = mock(ScopeExtractor.class); - ctx = mock(PolicyContext.class); registry.registerScopeExtractor(extractor); } diff --git a/spi/common/identity-trust-spi/build.gradle.kts b/spi/common/identity-trust-spi/build.gradle.kts index 5cb5dd1e7ed..2c9644a6975 100644 --- a/spi/common/identity-trust-spi/build.gradle.kts +++ b/spi/common/identity-trust-spi/build.gradle.kts @@ -21,6 +21,7 @@ plugins { dependencies { api(project(":spi:common:core-spi")) api(project(":spi:common:participant-spi")) + api(project(":spi:common:policy:request-policy-context-spi")) api(project(":spi:common:policy-engine-spi")) api(project(":spi:common:verifiable-credentials-spi")) api(libs.iron.vc) { diff --git a/spi/common/identity-trust-spi/src/main/java/org/eclipse/edc/iam/identitytrust/spi/scope/ScopeExtractor.java b/spi/common/identity-trust-spi/src/main/java/org/eclipse/edc/iam/identitytrust/spi/scope/ScopeExtractor.java index 42ca9d656eb..adc20fa1eb1 100644 --- a/spi/common/identity-trust-spi/src/main/java/org/eclipse/edc/iam/identitytrust/spi/scope/ScopeExtractor.java +++ b/spi/common/identity-trust-spi/src/main/java/org/eclipse/edc/iam/identitytrust/spi/scope/ScopeExtractor.java @@ -14,7 +14,7 @@ package org.eclipse.edc.iam.identitytrust.spi.scope; -import org.eclipse.edc.policy.engine.spi.PolicyContext; +import org.eclipse.edc.policy.context.request.spi.RequestPolicyContext; import org.eclipse.edc.policy.engine.spi.PolicyEngine; import org.eclipse.edc.policy.model.AtomicConstraint; import org.eclipse.edc.policy.model.Operator; @@ -36,5 +36,5 @@ public interface ScopeExtractor { * @param rightValue the right-side expression for the constraint. * @param context the policy context */ - Set extractScopes(Object leftValue, Operator operator, Object rightValue, PolicyContext context); + Set extractScopes(Object leftValue, Operator operator, Object rightValue, RequestPolicyContext context); } diff --git a/spi/common/identity-trust-spi/src/main/java/org/eclipse/edc/iam/identitytrust/spi/scope/ScopeExtractorRegistry.java b/spi/common/identity-trust-spi/src/main/java/org/eclipse/edc/iam/identitytrust/spi/scope/ScopeExtractorRegistry.java index e7412af02f9..8ef22b4d4c9 100644 --- a/spi/common/identity-trust-spi/src/main/java/org/eclipse/edc/iam/identitytrust/spi/scope/ScopeExtractorRegistry.java +++ b/spi/common/identity-trust-spi/src/main/java/org/eclipse/edc/iam/identitytrust/spi/scope/ScopeExtractorRegistry.java @@ -14,7 +14,7 @@ package org.eclipse.edc.iam.identitytrust.spi.scope; -import org.eclipse.edc.policy.engine.spi.PolicyContext; +import org.eclipse.edc.policy.context.request.spi.RequestPolicyContext; import org.eclipse.edc.policy.model.Policy; import org.eclipse.edc.runtime.metamodel.annotation.ExtensionPoint; import org.eclipse.edc.spi.result.Result; @@ -41,5 +41,5 @@ public interface ScopeExtractorRegistry { * @param policyContext The policy context * @return The set of scopes to use if succeeded, otherwise failure */ - Result> extractScopes(Policy policy, PolicyContext policyContext); + Result> extractScopes(Policy policy, RequestPolicyContext policyContext); }