Announcement Announcement Module
Collapse
No announcement yet.
LDAPTemplate: lots of questions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • LDAPTemplate: lots of questions

    Hi all!

    First of all, let me say I have absolutely no experience on LDAP.
    I need to retrieve users' information from LDAP (AD?) wherever the system is installed.

    1) The system needs to know the host to connect to. Can I use current NT user's domain if I find a way to get it? I also need to know the port. Maybe I could try the defaults (I only know 389. Are there others?).

    2) I need to login anonymously or using current NT user (without Acegi). I prefer to use current NT user, if possible. During the tests I did, I was able to login using user's distinguish name and password but, as the system do not know the structure of the LDAP tree, I need to login using the simple username, eg. "Administrator"/"Password" instead of "CN=Administrator,CN=Users,DC=project,DC=compa ny"/"Password". How can I do this?

    3) I need to search for a given username, but I don't know the "base dn" to use. Here's how I tried to do this search. If I use template.search("CN=Users,DC=lsu,DC=hp",...) I find something but, it I use template.search("",...), as the code below, I can't find anything.
    Code:
    EqualsFilter filter = new EqualsFilter("cn", username);
    template.search("", filter.toString(), new AbstractContextMapper() {
        protected Object doMapFromContext(DirContextOperations ctx) {	
            return ctx.getNameInNamespace();
        }
    });
    Thank you all in advance!
Working...
X