-
Notifications
You must be signed in to change notification settings - Fork 24
Policy Providers
Cyril Dangerville edited this page Jul 1, 2017
·
21 revisions
(draft)
Policy Providers are PDP extensions to get policies for evaluation from various kinds of policy repositories: local filesystem, remote services, databases, etc.
The following Policy Providers are provided out-of-the-box in open source:
ID | Description | XML schema URL | Required Maven dependency | Implementation class |
---|---|---|---|---|
{http://authzforce.github.io/core/xmlns/pdp/5.0} StaticRefPolicyProvider
|
Gets policies from a list of URLs to XACML Policy(Set) documents, each URL using any of the following schemes: http , https , file , jar , classpath . |
classpath:pdp.xsd |
org.ow2.authzforce /authzforce-ce-core-pdp-engine /9.0.1 (and later) |
org.ow2.authzforce.core.pdp.impl.policy.CoreRefPolicyProviderModule |
{http://authzforce.github.io/core/xmlns/test/3} MongoDBBasedPolicyProvider
|
Gets policies from a MongoDB database. | classpath:org.ow2.authzforce.core.pdp.testutil.ext.xsd |
org.ow2.authzforce /authzforce-ce-core-pdp-testutils /9.0.1 (and later) |
org.ow2.authzforce.core.pdp.testutil.ext.MongoDBRefPolicyProviderModule |
Column info:
- ID: XML {namespace}type to use to instantiate the extension in a PDP configuration file. The namespace is used in the PDP extensions schema to enable the extension, i.e. in the schema whose location is passed as
extensionXsdLocation
argument toBasePdpEngine.getInstance(...)
, you must have an entry:<xs:import namespace="http://authzforce.github.io/core/xmlns/test/3" />
(wherexs
would be the prefix associated to namespacehttp://www.w3.org/2001/XMLSchema
), except for extensions implemented in packageorg.ow2.authzforce.core.pdp.impl
; - XML schema URL:
uri
value to be used in the XML catalog entry, i.e. in the XML catalog whose location is passed ascatalogLocation
argument toBasePdpEngine.getInstance(...)
, you must have an entry:<uri name="{the XML namespace in *ID* column}" uri="{the XML schema location}" />
, except for extensions implemented in packageorg.ow2.authzforce.core.pdp.impl
. Follow the link to go to the XML schema where the extension's configuration format (XML type definition) is defined. - Implementation class: Java implementation class.
If and only if the implementation class of the Policy Provider you want to use is in package org.ow2.authzforce.core.pdp.impl
, jump to step 4 (skip 1 to 3).
- Make sure the JAR corresponding to the Required Maven dependency in table above for the Policy Provider you wish to use, and its own dependencies, if any, are on the classpath.
- Import the schema of the Policy Provider into the extension activation XSD file, e.g.
pdp-ext.xsd
, by adding a XSDimport
withnamespace
attribute only for each one - see ID column in table above for examples - like in this example. This extension activation XSD file is an XML schema that imports the schemas of all extensions you want to enable on the PDP. If all extensions are inorg.ow2.authzforce.core.pdp.impl
package, you do not need such a file; else if you don't have such apdp-ext.xsd
yet, just create one from the example. - For each extension's schema imported in
pdp-ext.xsd
, add auri
entry mapping the namespace to the actual XML schema URL - see XML schema URL column in table above for examples - to the XML catalog file, e.g.catalog.xml
, like in this example. If you don't have an XML catalog yet, just create one from the example. - In PDP configuration file, e.g.
pdp.xml
, sets therefPolicyProvider
element to the wanted Policy Provider's XML type - see ID column in previous table - and therootPolicyProvider
element to type{http://authzforce.github.io/core/xmlns/pdp/5.0}StaticRefBasedRootPolicyProvider
in order to make the PDP's root policy provided by therefPolicyProvider
itself, like in this example. If you don't have a PDP configuration file, just create one from the example. - Finally, in your code, in order to instantiate a PDP engine, use method
org.ow2.authzforce.core.pdp.impl.BasePdpEngine getInstance(final String confLocation, final String catalogLocation, final String extensionXsdLocation)
with aforementionedpdp.xml
,catalog.xml
andpdp-ext.xsd
asconfLocation
,catalogLocation
, andextensionXsdLocation
arguments respectively.