Jspresso provides all the necessary plumbing to seamlessly integrate any JAAS login module and as of this writing, there are 2 login modules that come with the framework :
• The development login module which does not require any backend and is perfectly suited for development.
• The ldap login module which authenticates the user against an LDAP directory [1].
You may find many other, freely available, JAAS login modules to meet your needs (JDBC, ascii encrypted file, ...).
Here, we will discuss the LDAP login module and its extension to deal with custom properties.
The Jspresso LdapLoginModule extends the JBoss 4.2.2 LdapExtLoginModule so its documentation [2] apply for the basic configuration. It's an enhanced module with support for custom properties to be extracted from he LDAP directory and stored in the Jspresso org.jspresso.framework.security.UserPrincipal (put/getCustomProperty).
The syntax for custom properties configuration is the following :
custom.propertyName="expression"
where expression is in the form :
recordDN[sliceStart, sliceEnd].attribute
some examples :
with slicing :
The same as above, but extracting an attribute instead of the DN :
Notes:
[1] As LDAP tools, see Apache Directory Studio. It works under Eclipse and contains anything you need. You can start with the embedded server and the browser. Even for a newbie like me, with it, LDAP is a breeze.
[2] See also http://www.jboss.org/community/wiki/LdapExtLoginModule