Thursday, February 21, 2008

Container Managed LDAP

<sigh> will these ldap posts ever end?

So now that I have authentication working, I want to be able to register users now.  So how can I save users easily to my ldap server?  Well I figured there had to be an easy way to get a container managed instance of the server, low and behold I found this post on making a container managed LDAP from a Java Evangelist.

Once you follow all of those instructions, what is the best way to get access to it?  With Spring of course!

It's as simple as injecting this into your bean

<bean id="ldapServer" 
class="org.springframework.jndi.JndiObjectFactoryBean"
lazy-init="default">
<property name="jndiName">
<value>ldap/directory</value>
</property>
<property name="resourceRef">
<value>false</value>
</property>
</bean>


Couldn't be easier. 

No comments: