Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Get a NDS parameter

Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a class that validate an user in NDS, but I need to get the value of one NDS parameter (called "Company") of the respective user. How can I do this? Please, I really need some help here.
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope this isn't for a homework assignment. Here's some code that might help you:

"myCtx" is an instance of "DirContext".
"attrName" and "attrValue" are attribute name and value you want to search by. For example, it could be "cn" and "jbrown". The attribute value can contain wild cards, etc., just standard LDAP stuff.
"searchScope" is one of teh valid "SearchControls.XXXX" values (ONELEVEL_SCOPE, OBJECT_SCOPE, SUBTREE_SCOPE, ...). Again pretty standard LDAP stuff.
In the example here it will retrieve all of the attributes from the matching object and save the key/value pairs in a "TreeMap". It only handles String (text) attribute values nicely, and it doesn't have allowance for multi-value attributes. I'm sure you can add those if you need.
It is fairly easy to modify this to handle multiple matches: this code only handles a single match, which is sufficient in many cases.
Hope this helps ...
I am Arthur, King of the Britons. And this is a tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic