diff --git a/src/main/java/edu/mostafa/abac/security/policy/BasicPolicyEnforcement.java b/src/main/java/edu/mostafa/abac/security/policy/BasicPolicyEnforcement.java index fc03a85..9a1ca74 100644 --- a/src/main/java/edu/mostafa/abac/security/policy/BasicPolicyEnforcement.java +++ b/src/main/java/edu/mostafa/abac/security/policy/BasicPolicyEnforcement.java @@ -6,6 +6,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.expression.EvaluationException; import org.springframework.stereotype.Component; @@ -14,6 +15,7 @@ public class BasicPolicyEnforcement implements PolicyEnforcement { private static final Logger logger = LoggerFactory.getLogger(BasicPolicyEnforcement.class); @Autowired + @Qualifier("jsonFilePolicyDefinition") private PolicyDefinition policyDefinition; /* (non-Javadoc) diff --git a/src/main/java/edu/mostafa/abac/security/policy/SimplePolicyDefinition.java b/src/main/java/edu/mostafa/abac/security/policy/SimplePolicyDefinition.java index 804ce2b..3942bdf 100644 --- a/src/main/java/edu/mostafa/abac/security/policy/SimplePolicyDefinition.java +++ b/src/main/java/edu/mostafa/abac/security/policy/SimplePolicyDefinition.java @@ -9,7 +9,7 @@ import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.stereotype.Component; -//@Component +@Component("simplePolicyDefinition") public class SimplePolicyDefinition implements PolicyDefinition { private List rules; diff --git a/src/main/java/edu/mostafa/abac/security/policy/json/JsonFilePolicyDefinition.java b/src/main/java/edu/mostafa/abac/security/policy/json/JsonFilePolicyDefinition.java index f56aad8..dc350bd 100644 --- a/src/main/java/edu/mostafa/abac/security/policy/json/JsonFilePolicyDefinition.java +++ b/src/main/java/edu/mostafa/abac/security/policy/json/JsonFilePolicyDefinition.java @@ -22,7 +22,7 @@ import edu.mostafa.abac.security.policy.PolicyDefinition; import edu.mostafa.abac.security.policy.PolicyRule; -@Component +@Component("jsonFilePolicyDefinition") public class JsonFilePolicyDefinition implements PolicyDefinition { private static Logger logger = LoggerFactory.getLogger(JsonFilePolicyDefinition.class); diff --git a/src/main/java/edu/mostafa/abac/security/spring/AbacPermissionEvaluator.java b/src/main/java/edu/mostafa/abac/security/spring/AbacPermissionEvaluator.java index 5b9bfff..ad86435 100644 --- a/src/main/java/edu/mostafa/abac/security/spring/AbacPermissionEvaluator.java +++ b/src/main/java/edu/mostafa/abac/security/spring/AbacPermissionEvaluator.java @@ -18,6 +18,7 @@ @Component public class AbacPermissionEvaluator implements PermissionEvaluator { private static Logger logger = LoggerFactory.getLogger(AbacPermissionEvaluator.class); + @Autowired PolicyEnforcement policy;