spring ldap
DESCRIPTION
This presentation was shown at Spring Framework Meeting 2009 in Rome (Lazio - Italy) - 31th October 2009. http://www.open4dev.com/journal/2009/10/26/spring-framework-meeting-2009-rome.html Abstract: Spring LDAP basics: how to start to use the LdapTemplate in your custom J2EE application. This how-to will show you how to bind, unbind, search and authenticate users in your LDAP using the LdapTemplate provided by Spring.TRANSCRIPT
![Page 1: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/1.jpg)
Spring LDAPSpring LDAP basics: how to start to use the
LdapTemplate in your custom J2EE application
![Page 2: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/2.jpg)
About meProduct Specialist at Sourcesense
ECMsystem integrationweb / portals
Alfresco
Certified Alfresco TrainerForum supporter (en, it)
JBoss Portal / GateIn
Project Leader:JBoss WikiJBoss Feeds/Blog
Committer:JBoss LabsJBoss PortletSwap JBoss Forums
Wiki editor + forum supporter
Contributions Database Dependencies (dbdep)
DbDep for Apache IvyDbDep for Apache Maven
CMIS Portlet Affiliate Partner at Packt PublishingCreative Commons supporter
Past
Editor at oneOpenSource.it My website: http://www.open4dev.com/ Where you can find me
http://www.open4dev.com/community/
![Page 3: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/3.jpg)
Agenda
1. ECM in the real world2. Introduction to LDAP 3. Spring LDAP
basicsoperations
AuthenticationSearchBindUnbindModify
![Page 4: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/4.jpg)
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.
WikipediaA system for organizing and facilitating collaborative creation of documents and other contentAble to monitor content through its lifecycle, and track changes to content, and users of contentSometimes a web application used for managing websites and web contentIn many cases, content management systems require special client software for editing and constructing articles
![Page 5: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/5.jpg)
ECM architecture - step 1
![Page 6: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/6.jpg)
ECM architecture - step 2
![Page 7: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/7.jpg)
Introduction to LDAP
![Page 8: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/8.jpg)
What is LDAP
Lightweight Directory Access Protocolentries based on an hierarchical tree: Directory Information Tree (DIT) manage information about people and servicesis a protocol over TCP/IP (DAP was over OSI)used with a Directory System Agent (DSA = LDAP Server)
Implementations
ApacheDSOpenLDAPOpenDS
![Page 9: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/9.jpg)
LDAP stored information
Usersstandard attributes (name, surname, address, age, etc...) custom attributes (department, skills, etc...)
Groups
memberscustom attributes (department, city, role)
![Page 10: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/10.jpg)
LDAP data structure
![Page 11: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/11.jpg)
LDAP data structure - Group
![Page 12: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/12.jpg)
LDAP data structure - User
![Page 13: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/13.jpg)
LDAP Directory Information Tree (DIT)
![Page 14: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/14.jpg)
LDAP Directory Information Tree (DIT)
![Page 15: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/15.jpg)
LDAP - BaseDN
BaseDN = ou=users, ou=system
![Page 16: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/16.jpg)
LDAP - Modification Logs - add user
![Page 17: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/17.jpg)
LDAP - Modification Logs - add user
![Page 18: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/18.jpg)
LDAP - Modification Logs - member
![Page 19: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/19.jpg)
LDAP features
Authentication ( = get LDAP context)encrypted user passwordsLDAP connector using TCP/IP (default port 389)
Authorization ( = search attributes)
groupsmembers
![Page 20: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/20.jpg)
Software architecture
![Page 21: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/21.jpg)
Software architecture - beans graph
![Page 22: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/22.jpg)
Software architecture - beans graph 2
![Page 23: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/23.jpg)
Software architecture
![Page 24: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/24.jpg)
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
![Page 25: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/25.jpg)
Spring LDAP - project page
![Page 26: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/26.jpg)
Spring LDAP - how to start with Maven
add in your pom.xml the following dependencies:
![Page 27: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/27.jpg)
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 classpath3. bind the source code for Spring LDAP libraries from: 4. spring-ldap-1.3.0.RELEASE-with-dependencies/dist/modules-source
![Page 28: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/28.jpg)
The traditional way
using Java LDAP standard
![Page 29: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/29.jpg)
Java LDAP
![Page 30: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/30.jpg)
Spring LDAP
Spring context configuration
![Page 31: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/31.jpg)
Spring Context - PropertyPlaceHolder
you can configure Spring contexts with properties files
![Page 32: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/32.jpg)
Spring Context - LdapTemplate
LdapTemplate is the core of Spring LDAP
![Page 33: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/33.jpg)
Spring context - ldap.properties
![Page 34: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/34.jpg)
Spring LDAP
Authentication
![Page 35: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/35.jpg)
Spring Context - AuthenticationDao
![Page 36: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/36.jpg)
Spring Bean - AuthenticationDAO.java
IoC pattern with setter injection
![Page 37: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/37.jpg)
POJO - LoginVO.java
![Page 38: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/38.jpg)
LdapTemplate
Authentication using Spring LDAP 1.2.1
![Page 39: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/39.jpg)
AuthenticationDAO.java - getUserDN
how to authenticate users using Spring LDAP 1.2.1
![Page 40: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/40.jpg)
Spring Context - AuthenticationBl
![Page 41: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/41.jpg)
Spring Bean - AuthenticationBl.java
![Page 42: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/42.jpg)
Spring Bean - AuthenticationBl.javahow to authenticate users using Spring LDAP 1.2.1
![Page 43: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/43.jpg)
LdapTemplate
Authentication using Spring LDAP 1.3.0
![Page 44: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/44.jpg)
Spring Context - AuthenticationBl
add ldapTemplate to your old implementation
![Page 45: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/45.jpg)
Spring Bean - AuthenticationBl.java
how to authenticate users using Spring LDAP 1.3.0
add dinamically filters for LDAP fieldsauthentication feature with custom constraints on your LDAPmuch easier to implement!
![Page 46: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/46.jpg)
Spring LDAP
Search
![Page 47: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/47.jpg)
SearchDAO.java - single attribute
returns a list with a single attribute
![Page 48: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/48.jpg)
Search - PersonVO.java
![Page 49: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/49.jpg)
SearchDAO.java - return an object
returns a list of Person objects
![Page 50: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/50.jpg)
SearchDAO.java - find a Person
![Page 51: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/51.jpg)
SearchDAO.java - dynamic filter
![Page 52: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/52.jpg)
Spring LDAP
Binding - how to insert entries
![Page 53: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/53.jpg)
PersonDAO.java - insert a new Person
![Page 54: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/54.jpg)
Spring LDAP
Unbinding - how to remove an entry
![Page 55: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/55.jpg)
PersonDAO.java - remove a Person
![Page 56: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/56.jpg)
Spring LDAP
Modifying - how to change an entry
![Page 57: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/57.jpg)
PersonDAO.java - Modifying using rebind
rebind = unbind + bindvery crude maybe you don't want to do this!
![Page 58: Spring Ldap](https://reader034.vdocuments.site/reader034/viewer/2022050720/54c6aeff4a795919748b459f/html5/thumbnails/58.jpg)
PersonDAO.java - Modifying using modifyAttributes