code: private Hashtable<String,Object> setupBasicProperties(Hashtable<String,Object> env, String providerUrl)
  			throws NamingException
  	{
  		// set the tracing level
  		if (tracing)
  			env.put("com.sun.jndi.ldap.trace.ber", System.err);
  
  		// always use ldap v3
  		env.put("java.naming.ldap.version", "3");
  
  		// use jndi provider
  		if (env.get(Context.INITIAL_CONTEXT_FACTORY) == null)
  			env.put(Context.INITIAL_CONTEXT_FACTORY, DEFAULT_CTX);
  
  		// usually what we want
  		env.put("java.naming.ldap.deleteRDN", "false");
  
  		// follow, ignore, throw
  		env.put(Context.REFERRAL, referralType);
  
  		// to handle non-standard binary attributes
  		env.put("java.naming.ldap.attributes.binary",
  				"photo jpegphoto jpegPhoto");
  
  		// finding, searching, etc.
  		env.put("java.naming.ldap.derefAliases", aliasType);
  
  		// no authentication (may be modified by other code)
  		env.put(Context.SECURITY_AUTHENTICATION, "none");
  
  		// the ldap url to connect to; e.g. "ldap://foo.com:389"
  		env.put(Context.PROVIDER_URL, providerUrl);
  
  		return env;
  	}
docs: -----------------------------------------------