From commits-return-22029-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Mon May 25 19:22:21 2009 Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 64281 invoked from network); 25 May 2009 19:22:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 May 2009 19:22:21 -0000 Received: (qmail 49075 invoked by uid 500); 25 May 2009 19:22:34 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 49015 invoked by uid 500); 25 May 2009 19:22:34 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 49006 invoked by uid 99); 25 May 2009 19:22:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 May 2009 19:22:34 +0000 X-ASF-Spam-Status: No, hits=-1994.3 required=10.0 tests=ALL_TRUSTED,HTML_MESSAGE,MIME_HTML_ONLY X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 May 2009 19:22:22 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 08FAD234C004 for ; Mon, 25 May 2009 12:22:00 -0700 (PDT) Message-ID: <1810566976.1243279320019.JavaMail.www-data@brutus> Date: Mon, 25 May 2009 12:22:00 -0700 (PDT) From: confluence@apache.org To: commits@directory.apache.org Subject: [CONF] Apache Directory SandBox: ApacheDS as a Tomcat Realm (page edited) MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org

ApacheDS as a Tomcat Realm has been edited by Stefan Zoerner (May 25, 2009).

(View changes)

Content:

ApacheDS Tomcat Realm

What is it, and who needs it?

Within Apache Tomcat, a realm is (cite) a "database" of usernames and passwords that identify valid users of a web application (or set of web applications), plus an enumeration of the list of roles associated with each valid user. Learn more about them in the Realm Configuration HOW-TO from the Tomcat website.

In order to use Apache Directory Server (ApacheDS) as a realm, the straight forward approach is to use the JNDIRealm shipped with Tomcat. It can handle arbitrary LDAP servers, among them ApacheDS.

Because ApacheDS is 100% pure Java and embeddable, there is another option: Implement the Realm interface from Apache Tomcat and run within Tomcat. There are (at least) two interesting things about this approach:

  • Tomcat can use ApacheDS without the wire protocol, because the realm has a handle to the "in process" API of ApacheDS
  • ApacheDS runs within Tomcat and starts and stops automatically along with the web application server

While the first point promises some performance advantages, which are irrelevant in most situations (because LDAP servers like ApacheDS are optimized for read operations anyway), the second reason makes this approach a good option for development environments.

Current state

I have started a Realm implementation. A first version (proof of concepts) already works quite well. I have committed the sources here as a Maven2 project:

https://svn.apache.org/repos/asf/directory/sandbox/szoerner/apacheds-tomcatrealm

It builds a jar file which contains the Realm class. In order to use it, one has to copy it to the Tomcat server lib directory, along with the required ApacheDS and dependency jars.

Activation in Tomcat server.xml is simply

<Realm className="org.apache.directory.tomcatrealm.EmbeddedApacheDsRealm" />

You can use Studio to edit your users and groups after Tomcat startup; the embedded ApacheDS opens an LDAP port at 10389.

I will continue testing and will provide some documentation on the wiki later on. Some features like configuration (LDAP port, filter expressions for searches, ...) are still missing, but I think it looks quite promising.

Feel free to check it out and provide feedback. Further discussions about whether we provide this as official artifact will be on the dev-list, which you hopefully scan as well.