Spring LDAP
 Spring LDAP basics: how to start to use the
LdapTemplate in your custom J2EE application
About me
 Product Specialist at Sourcesense    Contributions
     ECM                                  Database Dependencies (dbdep)
     system integration                         DbDep for Apache Ivy
     web / portals                              DbDep for Apache Maven
                                          CMIS Portlet
 Alfresco                                 Affiliate Partner at Packt Publishing
      Certified Alfresco Trainer          Creative Commons supporter
      Forum supporter (en, it)
                                      Past
 JBoss Portal / GateIn                       Editor at oneOpenSource.it
      Project Leader:
            JBoss Wiki
            JBoss Feeds/Blog
                                      My website:
      Committer:
            JBoss Labs                    http://www.open4dev.com/
            JBoss PortletSwap
            JBoss Forums              Where you can find me
      Wiki editor + forum supporter          http://www.open4dev.com/community/
Agenda

1. ECM in the real world
2. Introduction to LDAP
3. Spring LDAP
       basics
       operations
          Authentication
          Search
          Bind
          Unbind
          Modify
ECM=Enterprise Content Management

     AIIM Definition (Association for Information and Image Management)
  Enterprise Content Management embodies the technologies used to capture, manage, store,
preserve   and deliver content and documents related to organizational processes.

     Wikipedia
          A system for organizing and facilitating collaborative creation of documents and other content
          Able to monitor content through its lifecycle, and track changes to content, and users of
          content
          Sometimes a web application used for managing websites and web content
          In many cases, content management systems require special client software for editing and
          constructing articles
ECM architecture - step 1
ECM architecture - step 2
Introduction to LDAP
What is LDAP

Lightweight Directory Access Protocol
    entries based on an hierarchical tree: Directory Information Tree (DIT)
    manage information about people and services
    is a protocol over TCP/IP (DAP was over OSI)
    used with a Directory System Agent (DSA = LDAP Server)

Implementations
   ApacheDS
   OpenLDAP
   OpenDS
LDAP stored information

 Users
    standard attributes (name, surname, address, age, etc...)
    custom attributes (department, skills, etc...)

 Groups
    members
    custom attributes (department, city, role)
LDAP data structure
LDAP data structure - Group
LDAP data structure - User
LDAP Directory Information Tree (DIT)
LDAP Directory Information Tree (DIT)
LDAP - BaseDN



    BaseDN = ou=users, ou=system
LDAP - Modification Logs - add user
LDAP - Modification Logs - add user
LDAP - Modification Logs - member
LDAP features

 Authentication ( = get LDAP context)
    encrypted user passwords
    LDAP connector using TCP/IP (default port 389)

 Authorization ( = search attributes)
    groups
    members
Software architecture
Software architecture - beans graph
Software architecture - beans graph 2
Software architecture
Spring LDAP - resources


 project page: http://www.springsource.org/ldap
 downloads: http://www.springsource.com/download/community?project=Spring%20LDAP
 docs: http://static.springframework.org/spring-ldap/docs/1.3.x/reference/html/
 api: http://static.springframework.org/spring-ldap/docs/1.3.x/apidocs/
 forum: http://forum.springframework.org/forumdisplay.php?f=40
 source code: http://src.springframework.org/svn/spring-ldap/trunk
Spring LDAP - project page
Spring LDAP - how to start with Maven
add in your pom.xml the following dependencies:
Spring LDAP - how to start without Maven


 1. download the latest stable with dependecies from here: http://www.springsource.
    com/download/community?project=Spring%20LDAP
 2. extract and import all the libraries in your classpath
 3. bind the source code for Spring LDAP libraries from:
 4. spring-ldap-1.3.0.RELEASE-with-dependencies/dist/modules-source
The traditional way

using Java LDAP standard
Java LDAP
Spring LDAP

Spring context configuration
Spring Context - PropertyPlaceHolder




       you can configure Spring contexts with properties files
Spring Context - LdapTemplate

 LdapTemplate is the core of Spring LDAP
Spring context - ldap.properties
Spring LDAP

 Authentication
Spring Context - AuthenticationDao
Spring Bean - AuthenticationDAO.java

        IoC pattern with setter injection
POJO - LoginVO.java
LdapTemplate

Authentication using Spring LDAP 1.2.1
AuthenticationDAO.java - getUserDN
Spring Context - AuthenticationBl
Spring Bean - AuthenticationBl.java
Spring Bean - AuthenticationBl.java
         how to authenticate users using Spring LDAP 1.2.1
LdapTemplate

Authentication using Spring LDAP 1.3.0
Spring Context - AuthenticationBl




          add ldapTemplate to your old implementation
Spring Bean - AuthenticationBl.java

           how to authenticate users using Spring LDAP 1.3.0




     add dinamically filters for LDAP fields
     authentication feature with custom constraints on your
     LDAP
     much easier to implement!
Spring LDAP

   Search
SearchDAO.java - single attribute
      returns a list with a single attribute
Search - PersonVO.java
SearchDAO.java - return an object

       returns a list of Person objects
SearchDAO.java - find a Person
SearchDAO.java - dynamic filter
Spring LDAP

Binding - how to insert entries
PersonDAO.java - insert a new Person
Spring LDAP

Unbinding - how to remove an entry
PersonDAO.java - remove a Person
Spring LDAP

Modifying - how to change an entry
PersonDAO.java - Modifying using rebind




           rebind = unbind + bind
           very crude
           maybe you don't want to do this!
PersonDAO.java - Modifying using modifyAttributes
Thank you

        My website:
http://www.open4dev.com

Spring Ldap