Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Authenticate to AD with JNDI, use metadata?

robyne vaughn
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to authenticate from IBM/AS400 to Active Directory with JNDI. I'm new to java. I don't have a clue about Active Directory and it seems that the guys who installed it and administer it are less informed than one would hope for.
I found some example code which works to connect to AD. I connect using one password and then I change the context in order to try to authenticate the actual user. This code works as long as I hard-code the known variables. The problem is that I want to be able to use an input form and authenticate knowing nothing about the user except their user-id and password.
Either I don't know how to ask the question correctly, or the AD administrators honestly don't know what the hierarchy of our AD server is.
I saw something somewhere about being able to use JNDI to find out the metadata for the AD. I have no clue about how to code for that or whether it's actually possible.
Here is the code I use to connect with where a username and password and CO are hardcoded. (except that in this example all passwords, user-ids, and urls are not actual.) It is test code and I have coded some system.out.printlns to see how things are proceding.

How can I use the metadata api to determine AD's structure so that I can search from the top? Also, I'm not sure about how to search the subtrees.
Any help would be so appreciated.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic