Class MongoDbPolicyProvider

  • All Implemented Interfaces:
    Closeable, AutoCloseable, org.ow2.authzforce.core.pdp.api.policy.CloseablePolicyProvider<org.ow2.authzforce.core.pdp.api.policy.StaticTopLevelPolicyElementEvaluator>, org.ow2.authzforce.core.pdp.api.policy.CloseableStaticPolicyProvider, org.ow2.authzforce.core.pdp.api.policy.PolicyProvider<org.ow2.authzforce.core.pdp.api.policy.StaticTopLevelPolicyElementEvaluator>, org.ow2.authzforce.core.pdp.api.policy.StaticPolicyProvider

    public final class MongoDbPolicyProvider
    extends org.ow2.authzforce.core.pdp.api.policy.BaseStaticPolicyProvider
    Policy provider that retrieves policies (given a Policy(Set)IdReference) from documents in a MongoDB-hosted collection. The document structure must correspond (be mappable) to PolicyPojo , where the 'type' is either "{urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}Policy" for XACML 3.0 Policies or "{urn:oasis:names:tc:xacml:3.0:core:schema:wd-17}PolicySet" for XACML 3.0 PolicySets, the 'id' is the XACML Policy(Set)Id, the 'version' is the XACML Policy(Set)'s Version, and the 'content' property holds the actual XACML Policy(Set) document - depending on 'type' - as plain text XML.

    This policy provider does not support Policy(Set)IdReferences with LatestVersion and EarliestVersion attributes.

    TODO: performance optimization: cache results of BaseStaticPolicyProvider.get(org.ow2.authzforce.core.pdp.api.policy.TopLevelPolicyElementType, String, Optional, Deque) to avoid repetitive requests to database server

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String XACML3_POLICY_TYPE_ID
      'type' value expected in policy documents stored in database for XACML Policies
      static String XACML3_POLICYSET_TYPE_ID
      'type' value expected in policy documents stored in database for XACML PolicySets
      • Fields inherited from interface org.ow2.authzforce.core.pdp.api.policy.PolicyProvider

        NULL_POLICYREF_CHAIN1_ARGUMENT_EXCEPTION, UNLIMITED_POLICY_REF_DEPTH
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      org.ow2.authzforce.core.pdp.api.policy.StaticTopLevelPolicyElementEvaluator getPolicy​(String policyId, Optional<org.ow2.authzforce.core.pdp.api.policy.PolicyVersionPatterns> policyPolicyVersionPatterns)  
      org.ow2.authzforce.core.pdp.api.policy.StaticTopLevelPolicyElementEvaluator getPolicySet​(String policyId, Optional<org.ow2.authzforce.core.pdp.api.policy.PolicyVersionPatterns> policyPolicyVersionPatterns, Deque<String> policySetRefChain)  
      • Methods inherited from class org.ow2.authzforce.core.pdp.api.policy.BaseStaticPolicyProvider

        get, get, joinPolicyRefChains
      • Methods inherited from interface org.ow2.authzforce.core.pdp.api.policy.PolicyProvider

        getCandidateRootPolicy
    • Field Detail

      • XACML3_POLICY_TYPE_ID

        public static final String XACML3_POLICY_TYPE_ID
        'type' value expected in policy documents stored in database for XACML Policies
      • XACML3_POLICYSET_TYPE_ID

        public static final String XACML3_POLICYSET_TYPE_ID
        'type' value expected in policy documents stored in database for XACML PolicySets
    • Method Detail

      • close

        public void close()
      • getPolicy

        public org.ow2.authzforce.core.pdp.api.policy.StaticTopLevelPolicyElementEvaluator getPolicy​(String policyId,
                                                                                                     Optional<org.ow2.authzforce.core.pdp.api.policy.PolicyVersionPatterns> policyPolicyVersionPatterns)
                                                                                              throws org.ow2.authzforce.core.pdp.api.IndeterminateEvaluationException
        Specified by:
        getPolicy in class org.ow2.authzforce.core.pdp.api.policy.BaseStaticPolicyProvider
        Throws:
        org.ow2.authzforce.core.pdp.api.IndeterminateEvaluationException
      • getPolicySet

        public org.ow2.authzforce.core.pdp.api.policy.StaticTopLevelPolicyElementEvaluator getPolicySet​(String policyId,
                                                                                                        Optional<org.ow2.authzforce.core.pdp.api.policy.PolicyVersionPatterns> policyPolicyVersionPatterns,
                                                                                                        Deque<String> policySetRefChain)
                                                                                                 throws org.ow2.authzforce.core.pdp.api.IndeterminateEvaluationException
        Specified by:
        getPolicySet in class org.ow2.authzforce.core.pdp.api.policy.BaseStaticPolicyProvider
        Throws:
        org.ow2.authzforce.core.pdp.api.IndeterminateEvaluationException