First, you need to know some basic of JNDI:
Using J2EE Services (JNDI)

Second, the power of JAAS:
Java Authentication and Authorization Servic(JAAS)
and eBook: JAAS in Action

Then let’s do it!!
1. Developing JNDI-based Applications

2. What is the LDAP? Working with an LDAP directory server

3. Case study for JBoss + JAAS:
Integrating JBoss AS and LDAP
Introduction to Securing Web Applications with JBoss and LDAP

4. Reference:
JAAS tutorial for database communication
Spring LDAP