Pages

Showing posts with label ldap. Show all posts
Showing posts with label ldap. Show all posts

Wednesday, November 09, 2005

Embedding Apache Directory Server

Apache directory server is an embeddable LDAP server written in Java. It is now embedded in Jetspeed-2 which fully supports LDAP for authentication and partially for authorization. The Jetspeed-2 security SPI has been implemented to support LDAP. Embedding Apache directory server has been overall quite a pleasant experience.
The first step consisted in integrating Apache DS with Jetspeed-2 Maven Plugin:
<goal name="j2:_start.ldap">
...
<java classname="org.apache.ldap.server.ServerMain" fork="yes">
<classpath>
<pathelement
path="${maven.repo.local}/${plugin.groupId}/
jars/jetspeed-security-schema-${jetspeed.version}.jar"/>
<pathelement
path="${plugin.getDependencyPath('directory:apacheds-main')}"/>
</classpath>
<arg value="${org.apache.jetspeed.plugin.ldap.conf}"/>
</java>
</goal>
The above code invokes Apache DS ServerMain startup class with the server.xml configuration file parametrized through ${org.apache.jetspeed.plugin.ldap.conf}. As illustrated above, Apache DS is also started with the Jetspeed schema extensions. The pathelement element references jetspeed-security-schema which holds the Jetspeed specific schema extensions. The schema extensions java code is generated using the Apache DS Maven Plugin directory:schema goal. The classes are then compiled and archived as a referencable artifact for the LDAP server. Once the server is started, it is now time to bind to the LDAP server. Jetspeed-2 uses the Sun JDK LdapCtxFactory for its default binding configuration.