Spring Ldap

14,218 views

Published on

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.

Published in: Technology
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
14,218
On SlideShare
0
From Embeds
0
Number of Embeds
237
Actions
Shares
0
Downloads
487
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide

Spring Ldap

  1. 1. Spring LDAP Spring LDAP basics: how to start to use the LdapTemplate in your custom J2EE application
  2. 2. 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/
  3. 3. Agenda 1. ECM in the real world 2. Introduction to LDAP 3. Spring LDAP basics operations Authentication Search Bind Unbind Modify
  4. 4. 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
  5. 5. ECM architecture - step 1
  6. 6. ECM architecture - step 2
  7. 7. Introduction to LDAP
  8. 8. 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
  9. 9. LDAP stored information Users standard attributes (name, surname, address, age, etc...) custom attributes (department, skills, etc...) Groups members custom attributes (department, city, role)
  10. 10. LDAP data structure
  11. 11. LDAP data structure - Group
  12. 12. LDAP data structure - User
  13. 13. LDAP Directory Information Tree (DIT)
  14. 14. LDAP Directory Information Tree (DIT)
  15. 15. LDAP - BaseDN BaseDN = ou=users, ou=system
  16. 16. LDAP - Modification Logs - add user
  17. 17. LDAP - Modification Logs - add user
  18. 18. LDAP - Modification Logs - member
  19. 19. LDAP features Authentication ( = get LDAP context) encrypted user passwords LDAP connector using TCP/IP (default port 389) Authorization ( = search attributes) groups members
  20. 20. Software architecture
  21. 21. Software architecture - beans graph
  22. 22. Software architecture - beans graph 2
  23. 23. Software architecture
  24. 24. 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
  25. 25. Spring LDAP - project page
  26. 26. Spring LDAP - how to start with Maven add in your pom.xml the following dependencies:
  27. 27. 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
  28. 28. The traditional way using Java LDAP standard
  29. 29. Java LDAP
  30. 30. Spring LDAP Spring context configuration
  31. 31. Spring Context - PropertyPlaceHolder you can configure Spring contexts with properties files
  32. 32. Spring Context - LdapTemplate LdapTemplate is the core of Spring LDAP
  33. 33. Spring context - ldap.properties
  34. 34. Spring LDAP Authentication
  35. 35. Spring Context - AuthenticationDao
  36. 36. Spring Bean - AuthenticationDAO.java IoC pattern with setter injection
  37. 37. POJO - LoginVO.java
  38. 38. LdapTemplate Authentication using Spring LDAP 1.2.1
  39. 39. AuthenticationDAO.java - getUserDN
  40. 40. Spring Context - AuthenticationBl
  41. 41. Spring Bean - AuthenticationBl.java
  42. 42. Spring Bean - AuthenticationBl.java how to authenticate users using Spring LDAP 1.2.1
  43. 43. LdapTemplate Authentication using Spring LDAP 1.3.0
  44. 44. Spring Context - AuthenticationBl add ldapTemplate to your old implementation
  45. 45. 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!
  46. 46. Spring LDAP Search
  47. 47. SearchDAO.java - single attribute returns a list with a single attribute
  48. 48. Search - PersonVO.java
  49. 49. SearchDAO.java - return an object returns a list of Person objects
  50. 50. SearchDAO.java - find a Person
  51. 51. SearchDAO.java - dynamic filter
  52. 52. Spring LDAP Binding - how to insert entries
  53. 53. PersonDAO.java - insert a new Person
  54. 54. Spring LDAP Unbinding - how to remove an entry
  55. 55. PersonDAO.java - remove a Person
  56. 56. Spring LDAP Modifying - how to change an entry
  57. 57. PersonDAO.java - Modifying using rebind rebind = unbind + bind very crude maybe you don't want to do this!
  58. 58. PersonDAO.java - Modifying using modifyAttributes
  59. 59. Thank you My website: http://www.open4dev.com

×