• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

LDAP Active Direcory user attrbinutes

Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to perform userAuthentication and user attribute retrieval using LDAP. I have done authentication using code below but getting problem while retrieving attributes, constraint is I dont have administrator id/pass for security resons but i have to get basic attributes like first name, last name etc. Can any one provide me some hint/code sample that would help me.

This is the authentication code:
String contextFactory = "com.sun.jndi.ldap.LdapCtxFactory";
String userId = "userId@myDomain.com";
String password = "password";
Hashtable env = new Hashtable(5);
env.put(Context.INITIAL_CONTEXT_FACTORY,contextFactory );
env.put(Context.PROVIDER_URL, "ldap://myServer:389"; );
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, userId);
env.put(Context.SECURITY_CREDENTIALS, password);
DirContext mDirCtx = null;
mDirCtx = new InitialDirContext(env);
}catch(Exception e){
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic