You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by le...@cocoon.apache.org on 2004/07/16 10:12:41 UTC

[Cocoon Lenya Wiki] New: LDAPAuth

   Date: 2004-07-16T01:12:41
   Editor: WolfgangKaltz <jw...@yahoo.com>
   Wiki: Cocoon Lenya Wiki
   Page: LDAPAuth
   URL: http://wiki.apache.org/cocoon-lenya/LDAPAuth

   no comment

New Page:

= How To Activate LDAP Authentication within a Lenya Publication =

== Introduction ==
LDAP Authentication is already integrated within Lenya. However, there is no GUI within the common area or the default publication to use it in the current version (1.2). So, activating LDAP authentication within your publication means :

 * 1. Creating the ldap.properties file with your LDAP settings;
 * 2. Editing the Administration GUI, in order to add LDAP relevant buttons

This How-To is intended for Lenya 1.2, and was furthermore tested on the Lenya state in CVS on July 9th, 2004

Later versions may already have more LDAP stuff already off-the-shelf.

== LDAP Configuration file(s) ==
The LDAP configuration file(s) are to be placed in this directory: lenya/pubs/<your-publication-name>/config/ac/passwd

In this directory, create a file called ldap.properties

Here is an example content (inspired by the "unizh" publication):
{{{
# File: ldap.properties
provider-url=ldap://ldap.foodomain.com:636/ou=FooOrg,dc=foodomain,dc=com

# Manager/user which is allowed to retrieve a list of "all" users (fullname) from LDAP server
# This can be the LDAP admin, for instance, or can be left empty for anonymous bind
mgr-dn=cn=proxyauth,ou=People,ou=FooOrg,dc=foodomain,dc=com
# Password 
mgr-pw=sekret

partial-user-dn=ou=People,ou=FooOrg,dc=foodomain,dc=com
# keystore is taken relatively to the publication config/ac directory
#key-store=.keystore
#security-protocol=ssl
security-protocol=none
security-authentication=simple
}}} 

Now, edit this file to suit your needs:
 * use your settings for "provider-url" and "partial-user-dn"
 * if you wish to use anonymous bind, set "mgr-dn" and "mgr-pw" to empty. If you do this, you will be able to use LDAP authentication, but users won't be able to change their LDAP passwords
 * if you don't wish to use anonymous bind, set "mgr-dn" and "mgr-pw" to the relevant LDAP administrator settings of your LDAP server
 * if you wish to use unencrypted LDAP, set "security-protocol" to the value none
 * if you wish to use encrypted LDAP, you need to have a .keystore file (see below)

=== Encrypted LDAP ===
 *  in the file ldap.properties, set security-protocol to the value ssl and set key-store to the name of your keystore file
 * add the LDAP server certificate file to the local keystore using this command:
{{{
      keytool -import -keystore .keystore -file <ca_cert_file> -alias <yourdomain.com>
}}}

=== Notes ===
If you modify ldap.properties, it may be necessary to restart your servlet container in order for the changes to take effect.

== An example publication using LDAP Authentication: the University of Zurich Lenya Publication ==
The "University of Zurich Publication" is an example of a publication which uses LDAP authentication. I recommend installing it and configuring to authenticate against your LDAP server: this way, you can check whether LDAP authentication is working, before proceeding to activate it in another application.

Note: this HOW-TO was tested using the "University of Zurich Publication" state on May 26th, 2004. If another version is incompatible with your Lenya installation, don't despair, you will probably still be able to use the LDAP relevant stuff.
 * 1.  Retrieve the University of Zurich Lenya Publication described on http://wyona.org/
 * 2. Copy, from the unizh/pubs directory, the subdirectories "unitemplate" and "unizh" to the "lenya/pubs" subdirectory of your Lenya installation
 * 3. Go to the "lenya/pubs/unitemplate/config/ac/passwd" and edit ldap.properties as described above; and, if secure LDAP is required, add the server certificate to the keystore as described above.
 * 4. In your browser, refresh your Lenya start page. You should now see, on the left hand side, a link to the "Unitemplate" publication. Login as lenya / levi user and go the Admin area to add a user.
 * 5. Click on "Add University User" (this means LDAP user). In the field "UniAccessID", use the LDAP userid. In the field "CMS User", use the id with which you want to user to log in to Lenya. This may be the same id as for LDAP.
 * 6. Add the desired groups for this user and log out of Lenya.
 * 7. You should now be able to login to Lenya using this new user and his/her LDAP password.

== Activating LDAP Authentication in your publication ==
We will use the "default publication" as an example. 

First, as described above, ensure you have placed the correct LDAP configuration file(s) into the lenya/pubs/default/config/ac/passwd directory of your Lenya installation.

Now, add LDAP relevant stuff to your Administration GUI. The simplest way to achieve this is to copy the relevant Administration GUI components from the "University of Zurich Lenya Publication".
 * 1.  Go to the lenya/pubs/default/lenya/xslt subdirectory of your Lenya installation (careful, don't confuse this with the lenya/pubs/default/xslt subdirectory)
 * 2. Create a subdirectory called "admin", then within the "admin" subdirectory, a new subdirectory "users"
 * 3. Copy, into this new subdirectory, the 2 .xsl files called "profile.xsl" and "users.xsl" from the corresponding directory of the "University of Zurich Lenya Publication" (in lenya/pubs/unitemplate/lenya/xslt/admin/users)
 * 4. Login to the "default publication" as administrator (lenya/levi) and go the Admin area to add a user. You should now see a "Add University User" button - this actually refers to the LDAP users.
 * 5. In the field "UniAccessID", use the LDAP userid. In the field "CMS User", use the id with which you want to user to log in to Lenya. This may be the same id as for LDAP.
 * 6. Add the desired groups for this user and log out of Lenya.
 * 7. You should now be able to login to Lenya using this new user and his/her LDAP password.

== More technical information ==
 * Lenya uses the Cocoon class LDAPTransformer : for documentation see, in your Lenya installation, the file api/java/org/apache/cocoon/transformation/LDAPTransformer.html; or within the Cocoon documentation on http://cocoon.apache.org
 * This LDAPTransformer is included in Lenya's sitemap (sitemap.xmap)

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-dev-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-dev-help@cocoon.apache.org