J
Justin
I am trying to write a command line utility to query Active Directory
and process the results into an Oracle database. We would like to have
this app run as a scheduled task, however I am not able to connect to
the LDAP server without entering a username and password in clear text
in some form (arguments, properties file, hard coded, etc). Ideally
this bind would occur as the currently logged in user (Run As in the
case of a schedule task). I have played around with JAAS, and while I
might be missing something, it does not seem to be what I am looking
for. It seems as though it is able to connect, however as an anonymous
user, which does not have query privileges. Can anyone provide any
help?
Thanks in advance.
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://" + server + ":" + port);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
//
//Does not work with these lines commented out.
//
//env.put(Context.SECURITY_PRINCIPAL, username+"@"+domain);
//env.put(Context.SECURITY_CREDENTIALS, password);
DirContext ctx = new InitialDirContext(env);
and process the results into an Oracle database. We would like to have
this app run as a scheduled task, however I am not able to connect to
the LDAP server without entering a username and password in clear text
in some form (arguments, properties file, hard coded, etc). Ideally
this bind would occur as the currently logged in user (Run As in the
case of a schedule task). I have played around with JAAS, and while I
might be missing something, it does not seem to be what I am looking
for. It seems as though it is able to connect, however as an anonymous
user, which does not have query privileges. Can anyone provide any
help?
Thanks in advance.
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://" + server + ":" + port);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
//
//Does not work with these lines commented out.
//
//env.put(Context.SECURITY_PRINCIPAL, username+"@"+domain);
//env.put(Context.SECURITY_CREDENTIALS, password);
DirContext ctx = new InitialDirContext(env);