nammar
nammar

Reputation: 29

Generate XACML 2.0 policies programmatically?

I would like to generate XACML 2.0 policies programmatically. Is there a way to either do that or convert a group of XACML 3.0 policies into XACML 2.0 policies?

Thanks

Upvotes: 0

Views: 440

Answers (1)

David Brossard
David Brossard

Reputation: 13834

Yes and yes.

First of all, can you generate XACML 2.0 policies programmatically? Yes, you can. The same applies to XACML 3.0 or any schema-based XML content. The way to do that in Java is to use JAXB.

JAXB will take an XML Schema that you write and create a set of classes that correspond to that schema. The JAXB utilities will create the hierarchy of data structures for manipulating that XML. (quoting from What is JAXB and why would I use it?).

Just give JAXB the XACML 2.0 and XACML 3.0 schemas and you will get a set of classes you can use to programmatically create XACML policies, requests, and responses.

With respect to converting though, there are a few possible approaches:

  • implement the logic yourself using JAXB XACML 2.0 objects and converting into JAXB XACML 3.0 objects
  • Write XSLT to do it for you. XSLT is a language that will take in an XML schema (or an instance of a schema) and convert that schema to pretty much anything (web pages, PDF, and of course XML too). XSLT is great for converting from XACML 2.0 to 3.0.
  • Have an XML tool do the heavy lifting for you. The best tool in this space (that will generate code and XSLT) is Altova's XML suite (I am not affiliated with them).

HTH, David.

Upvotes: 1

Related Questions