Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Anchortoptop

This sample shows how you can use a Lightweight Directory Access Protocol (LDAP) server to configure and control access to resources on your Geronimo server.

...

NOTE: The Apache Geronimo-Apache Directory plugin can not be installed in Geronimo 2.1.2. If you are using Geronimo 2.1.2 with this sample you must use an external LDAP server. However, the Apache Geronimo-Apache Directory plugin can be installed in Geronimo 2.1.3 and this sample works equally well with the Geronimo 2.1.3.

...

This article is organized in the following sections:

...

Starting the LDAP server

If you installed the Apache Geronimo-Apache Directory Plugin it should have been started as part of the installation. You can verify that it is started from command line using the deployer tool or via the Geronimo Administration Console.

...

When you installed the Apache Geronimo-Apache Directory plugin you may have noticed a message on the console similar to the following:

...

...

This is because the directory server does not yet have any content. You can manually add the content necessary for the sample by including the ldap-sample.ldif from the sample source in the location specified in the message (<geronimo-home>/var/ldif/) and restarting the Geronimo server or optionally just the directory configuration in the server.

...

When you export the initial configuration you get an ldif file with a content similar as the one shown in the following example.

...

...

Now you need to import the entries needed to run the sample application. Packaged with the sample application is a sample .ldif file with all the entries necessary to run the LDAP sample application, this file is located in <ldap_home>/ldap-sample.ldif. To import the data with ldapmodify tool execute the following command:

...

The following example shows the content of the ldap-sample.ldif file.

...

...

Once the file is imported you should get a confirmation that five entries were successfully imported.

...

The LDAP sample application provides a security realm that needs to be deployed before the deployment of the application itself. This realm is located in <ldap_home>/ldap-realm.xml and the content is illustrated in the following example.

...

This deployment plan tell Geronimo all the connection and search parameters against the LDAP database. This plan also specifies to record each login attempt into the login-attempts.log log file.

...

Once deployed you should see a confirmation message similar to the following example:
No FormatbgColor#000000borderStylesolid D:\geronimo-tomcat6-jee5-2.0\bin>deploy deploy \samples\2.0\ldap-sample-app\ldap-realm.xml Using GERONIMO_BASE: D:\geronimo-tomcat6-javaee5-2.1.2 Using GERONIMO_HOME: D:\geronimo-tomcat6-javaee5-2.1.2 Using GERONIMO_TMPDIR: D:\geronimo-tomcat6-javaee5-2.1.2\var\temp Using JRE_HOME: C:\Java\jdk1.5.0_06\\jre Deployed console.realm/LDAP_Sample_Realm/1.0/car
Back to Top

For further details refer to the LDAP Realm section.

...

There is a common deployment plan that is used for the sample. The unprocessed version of this plan is at ldap-sample-app/ldap-sample-app-jetty/src/main/plan/plan.xml. The processed version shown here with plugin name and all dependencies filled in can be found at ldap-sample-app/ldap-sample-app-jetty/target/resources/META-INF/plan.xml after building the project.

...

Most of the deployment plan is straight forward. However, the security configuration is tricky. The <security-realm-name> is described in the <security> element through a sequence of declarations in each <realm> element.

...

The web.xml deployment descriptor shown in the following example (also located in the <ldap_home>/WEB-INF diretory) adds security constraints based on the location of the files.

...

...

Back to Top

Package the sample application

...

Once the Web application is successfully deployed you should see a confirmation message similar as the one shown in the following example:

No FormatbgColor#000000borderStylesolid D:\geronimo-tomcat6-jee5-2.0\bin>deploy deploy \samples\2.0\ldap-sample-app\ldap-demo.war Using GERONIMO_BASE: D:\geronimo-tomcat6-javaee5-2.1.2 Using GERONIMO_HOME: D:\geronimo-tomcat6-javaee5-2.1.2 Using GERONIMO_TMPDIR: D:\geronimo-tomcat6-javaee5-2.1.2\var\temp Using JRE_HOME: C:\Java\jdk1.5.0_06\\jre Deployed samples/LDAP_Sample/1.2/war @ http://localhost:8080/LDAP_Sample

To test the LDAP application open a Web browser and access the following URL:

...