LDAP - Websphere

This is a discussion on LDAP - Websphere ; Is there any way to setup LDAP as a resource in WAS and then from Java code to access its context? An example for DataSource would be: DataSource ds = (DataSource) (new InitialContext().lookup("java:comp/env/jdbc/mydb")); I'm looking for something like this: LdapContext ...

+ Reply to Thread
Results 1 to 12 of 12

Thread: LDAP

  1. LDAP


    Is there any way to setup LDAP as a resource in WAS and then from Java code
    to access its context?

    An example for DataSource would be:

    DataSource ds = (DataSource) (new
    InitialContext().lookup("java:comp/env/jdbc/mydb"));

    I'm looking for something like this:

    LdapContext ctx = (InitialLdapContext)(new
    InitialContext().lookup("java:comp/env/ldap/myldap"));

    Is that possible?



  2. Re: LDAP

    John Smith wrote:
    > Is there any way to setup LDAP as a resource in WAS and then from Java code
    > to access its context?
    >
    > An example for DataSource would be:
    >
    > DataSource ds = (DataSource) (new
    > InitialContext().lookup("java:comp/env/jdbc/mydb"));
    >
    > I'm looking for something like this:
    >
    > LdapContext ctx = (InitialLdapContext)(new
    > InitialContext().lookup("java:comp/env/ldap/myldap"));
    >
    > Is that possible?
    >
    >


    Is the LDAP your user registry, or just some directory server that you
    want to access ?

  3. Re: LDAP


    Just some directory I would like to connect with.



  4. Re: LDAP

    There is no generic LDAP resource outside of the scope of the user registry. However, with WAS 6.1, you can federate multiple repositories as part of the user registry. This means you could continue to use any directory you have setup for the UR and add your other directories to the WAS config and access the federated UR from your code...maybe.

  5. Re: LDAP

    Is it possible if the same user registry was used?

  6. Re: LDAP

    pranay.pathik@coles.com.au wrote:
    > Is it possible if the same user registry was used?


    You can then use the UserRegistry interface that is provided by WAS.

    http://publib.boulder.ibm.com/infoce...rRegistry.html

  7. Re: LDAP

    Is there a solution that will work on WAS 5.1?



    I have a similar situation:


    • I need to do searches across 2 Active Directory domains (this requires binding with a username/password to each server).

    • It's not possible to upgrade WAS to 6.1 at this time.

    • The user performing the search won't necessarily have an account on both domains, so I can't bind using their credentials.




    I've been chasing my tail on this for a couple days, and the only thing I can come up with is to stash the (encrypted) binding credentials in a .properties file somewhere. Surely there's a cleaner/better answer. Anybody?



    Thanks,



    Tom

  8. Re: LDAP

    You can setup any resource using Resource Environment Provider. You can use it for setting up the LDAP configuration.



    If you need any help regarding the Resource Environment Provider I can upload the whole setup procedure and examples of using it.

  9. Re: LDAP

    Please do. I could use all the help I can get at this point.



    Tom

  10. Re: LDAP

    Here it is and read "Read Me.txt".

  11. Re: LDAP

    Thanks for providing the code. I followed the readme.txt and How to use resources in java document too. I am coming across a naming exception when I use



    Object obj = ctx.lookup("java:comp/env/Configuration");



    I also tried



    Object obj = ctx.lookup("java:comp/env/Config"); ( as the class used is Config )



    In both cases, I get the following error. What am I doing wrong or am I missing something else in set-up?



    Exception details Name "comp/env/Config" not found in context "java:". : Name "comp/env/Config" not found in context "java:".



    Thanks again for your help.

  12. Re: LDAP

    Well, the resource provider solved the problem, the app is in production, and all is well. Thanks.



    I also found this article on resource providers, which provides a lot of background and step-by-step instructions on how to set one up.



    http://www.ibm.com/developerworks/websphere/library/techarticles/0611_totapally/0611_totapally.html



    Thanks again,



    Tom

+ Reply to Thread