4 Replies Latest reply on Dec 11, 2008 1:14 AM by shane.bryzak

    Connect to a LDAP server

      Hi,


      I wonder if there is a way to use Seam to connect to a LDAP server. There is the LdapIdentityStore to authenticate users, but I just want to get a LDAP connection to do some searches. I could create a Ldap class with a ejb name and than inject it where I need the ldap connection but I wonder if there not better way.


      Thanks,


      Jeronimo

        • 1. Re: Connect to a LDAP server

          I suggest you start here

          • 2. Re: Connect to a LDAP server
            shane.bryzak

            There's not really any special support in Seam for interacting with an LDAP directory.  To be honest, I don't see how we could simplify it any than the javax.naming API already makes it.  Although of course if you've got some ideas for a specific feature that would make it easier, I'd like to hear about it.

            • 3. Re: Connect to a LDAP server
              traviskds

              Hi Shane,


              Does this mean that for example if I need to read the value of an attribute in the ldap entry for the user, I will have to use the javax.naming API. So that means then I will have to directly bind via java and do this. Please let me know if my understanding is correct or if there is an easier way in seam.


              I looked at the LdapIdentityStore and there does not seem to be a method where I can pass the ldap attribute name and get the value.


              I would image a feature like that will be great as large organizations tend to put a lot of information in ldap (ie active directoty). For example, the email address, empoyee id etc is stored in active directory. I was thinking if I can pass the attribute name to a method on the ldapIdentityStore and then it returns the attribute value. simple as that. Not sure if seam can do this. Else maybe I will have to extend the ldapIdentityStore store and implement this.

              • 4. Re: Connect to a LDAP server
                shane.bryzak

                LdapIdentityStore is intended only to be used for identity-related operations.  If you want to query an LDAP directory for other stuff then I recommend you write a new component for this purpose.