The Hello World PEP
AzService azService = new org.openliberty.openaz.pdp.provider.SimpleConcreteService();
PepRequestFactory pep = new PepRequestFactory(CONTAINER,azService);
PepRequest req = pep.newPepRequest("josh","hello","world");
PepResponse resp = req.decide();
System.out.println(resp.allowed());
if (resp.allowed()) {
Map<String,Obligation> obligations = resp.getObligations();
Iterator obligationsIt = obligations.keySet().iterator();
while (obligationsIt.hasNext()) {
String obligationName = obligationsIt.next();
Map values = obligations.get(obligationName);
System.out.println(obligationName+"=>"+values);
}
}
The org.openliberty.openaz.pdp.provider.SimpleConcreteService is the example AzService (wrapper around XACML) that is there in the OpenAz project. Soon, we'll get an implementation of the AzService that uses the Sun XACML implementation.. Using the AzService we get a handle to the PEPRequestFactory. The PEPRequestFactory is used to generate one a PEPRequests. In the example, we're using the most basic for - simply passing in a String for the user, the action, and the resource. Once the request is generated, a response is returned and we can process the result. The response has a simple yes/no result, and then a handle to process the obligations. Obligations, as we've discussed on numerous occasions on this blog, can be used to have the PDP communicate additional responses to the PEP.
Features of the PEP Layer
The example above shows how simple doing very basic PEP calls, but there are a number of powerful features that are worth highlighting
What should I do next?
You can join the OpenAz mailing list, to follow and add to the discussion. Take a look at the project or sourceforge and contribute, or just give feedback on the API. A good place to start is with the tests. This shows some of the basic useage of the API.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.