HomeDownloadsUser GuideDevelopment

User Guide: Examples

Your Permis distribution includes an examples folder which contains all the examples listed below.

Example Structure

Care has been taken to create the examples as self-explanatory as possible. If appropriate each example includes:

  • readme.txt a short introduction to the example.
  • build.xml an ANT build file to simplify building and executing.
  • src/ the folder containing the actual example sources.
  • resources/ additional resources required for the example.

Simple

This 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 main method of the 'examples/simple/HelloWorld.java' file.

EJB

Example that shows how to separate the authorization service and the client using it as an EJB3 application.
The example includes all files necessary to build and test the application using a JBoss 5.x.

LDAP

This 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.

Once you have generated the file 'fixture.ldif', copy it in the folder 'examples/ldap' of the 'integration' project, overwriting the copy which is already there.

To start the LDAP server execute 'ant' in the folder 'examples/ldap' of the 'integration' project.

Once you started the LDAP server you may run 'examples/ldap/HelloWorld.java' directly from Eclipse or from the distribution by executing 'ant run' in its distribution folder.