spring ldap

Post on 27-Jan-2015

136 Views

Category:

Technology

5 Downloads

Preview:

Click to see full reader

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

Spring LDAPSpring LDAP basics: how to start to use the

LdapTemplate in your custom J2EE application

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/

Agenda

1. ECM in the real world2. Introduction to LDAP 3. Spring LDAP

basicsoperations

AuthenticationSearchBindUnbindModify

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

ECM architecture - step 1

ECM architecture - step 2

Introduction to LDAP

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

LDAP stored information

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

Groups

memberscustom 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 passwordsLDAP connector using TCP/IP (default port 389)

Authorization ( = search attributes)

groupsmembers

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 classpath3. 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

how to authenticate users using Spring LDAP 1.2.1

Spring Context - AuthenticationBl

Spring Bean - AuthenticationBl.java

Spring Bean - AuthenticationBl.javahow 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 fieldsauthentication feature with custom constraints on your LDAPmuch 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 + bindvery crude maybe you don't want to do this!

PersonDAO.java - Modifying using modifyAttributes

Thank you

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

top related