User Guide: ExamplesYour Permis distribution includes an examples folder which contains all the examples listed below. This chapter shortly explains how to install and run the examples. However if you want to run the examples we strongly advice you to check out and set up the integration project and to run its shell scripts first. So: go to integration before continuing with this page! SimpleThis example is explained in detail in the ten minute tutorial, however, you can quickly run it from both Eclipse or the distribution. To run it from the distribution, go to the example's distribution directory and then execute 'ant' to generate the certificates and 'ant run' to run the example. To run it from Eclipse execute './build.sh
examples-simple.certs4ide' from the projects root and then execute the XACMLThis example shows quickly how a PERMIS authorization service is
created, which takes XACML-Requests and returns XACML-Responses. To run it from the distribution, go to the example's distribution directory and then execute 'ant compile' to compile and 'ant run' to run the example. EJBExample that shows how to separate the authorization service and
the client using it as an EJB3 application. You will need an EJB server to compile and run this example. The example has been tested and pre-configured to work JBoss 5.x and consists of a simple EJB3 bean and a rich client. Preparations
Compiling/Deploying the EJB
Once the example is deployed you should see the following server
output: Compiling/Starting the Client
A simple Swing-based GUI will give you the option to choose between user "Mike" or "Sten". The EJB is configured to grant permission to "Mike" while "Sten" does not have permission. Modifying the ExampleTo keep the example small and simple the resources and configurations used are mostly hard-coded in the client and server classes. However since those classes are small and there are not many resources you should be able to modify the classes or use them as a starting point for your own implementation. The resources for the PDP which is embedded in the EJB are stored in the 'resources' folder. The certificates read and the policy ace file used are hard-coded in the org.openpermis.examples.ejb.server.HelloWorldService. The users offered at the client chooser are hard-coded in the client class org.openpermis.examples.ejb.client.HelloWorldClient. The following configuration files might also be of interest to you:
Build CommandsThe following build targets are available: LDAPThis example shows how to use an LDAP server as your storage location for policies and certificates. An LDAP server is available in the 'integration' project. So check out the 'integration' project before running this example. Analogously to the 'simple' example, you can run this example from both Eclipse or the distribution. The only difference is that this time the certificates are on the LDAP server. Before starting the LDAP server you have to generate the ldif-file with the certificates. You can generate it from the project's root by executing './build.sh examples-ldap.ldif'. This generates the file 'fixture.ldif' in the directory 'target/eclipse/ldap'. You can also generate the file 'fixture.ldif' from the distribution by executing 'ant' in the example's distribution directory. This generates the file 'fixture.ldif' in the 'classes' directory of the example's distribution directory. When you start the ldap server make sure that you fill it with the data from 'fixture.ldif'. To expand the ldap schema with the PmiUser class you can use the file 99-user.ldif which you can find in the folder ldap/resources/org/openpermis/examples/ . |