How to get structure of Active Directory through LDAP

Discussion in 'Java' started by Ronen Diment, Dec 8, 2003.

  1. Ronen Diment

    Ronen Diment Guest

    Hi!

    I'm trying to connect to an active directory through LDAP , on java client.

    I dont know the structure of the active directory so I dont know what
    parameters I Should pass to getAttributes().

    Do you know how to get the strcuture(List of all the elements) of the Active
    Directory?

    The code:

    Hashtable env = new Hashtable(11);

    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");

    env.put(Context.PROVIDER_URL, "ldap://ldap.public.com:389");

    try { // Create the initial directory context

    DirContext ctx = new InitialDirContext(env);

    // Dont know the structure - What parameters to supply??

    Attributes attrs = ctx.getAttributes("DC=myOrg,DC=int");

    Thanks,

    Ron
     
    Ronen Diment, Dec 8, 2003
    #1
    1. Advertising

  2. "Ronen Diment" <> wrote in message news:<KaQAb.102359$>...
    > Hi!
    >
    > I'm trying to connect to an active directory through LDAP , on java client.
    >
    > I dont know the structure of the active directory so I dont know what
    > parameters I Should pass to getAttributes().
    >
    > Do you know how to get the strcuture(List of all the elements) of the Active
    > Directory?
    >
    > The code:
    >
    > Hashtable env = new Hashtable(11);
    >
    > env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
    >
    > env.put(Context.PROVIDER_URL, "ldap://ldap.public.com:389");
    >
    > try { // Create the initial directory context
    >
    > DirContext ctx = new InitialDirContext(env);
    >
    > // Dont know the structure - What parameters to supply??
    >
    > Attributes attrs = ctx.getAttributes("DC=myOrg,DC=int");
    >
    > Thanks,
    >
    > Ron


    Get an LDAP browser (e.g. http://www.iit.edu/~gawojar/ldap/ ) and use
    it to inspect your AD; afaik, the one linked above provides reasonable
    defaults to connect.

    Olaf
     
    Olaf Lenzmann, Dec 9, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marty Underwood

    Active Directory using LDAP query

    Marty Underwood, Nov 27, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    628
    Marty Underwood
    Nov 27, 2003
  2. Andrew
    Replies:
    1
    Views:
    606
    Kevin Spencer
    Jun 24, 2004
  3. =?Utf-8?B?TWFyc2hhbGw=?=

    LDAP Active Directory Bind Stops Working

    =?Utf-8?B?TWFyc2hhbGw=?=, Oct 13, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    4,107
    =?Utf-8?B?TWFyc2hhbGw=?=
    Oct 18, 2004
  4. Tdar
    Replies:
    2
    Views:
    8,977
    Arnel
    Oct 11, 2005
  5. Replies:
    2
    Views:
    288
    Rui Maciel
    Dec 12, 2012
Loading...

Share This Page