@Provides @Singleton
LdapContext provideLdapContext() {
try {
Properties properties = new Properties();
InputStream xmlStream = getClass().getResourceAsStream("/META-INF/ldap.xml");
properties.loadFromXML(xmlStream);
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, properties.get(Context.INITIAL_CONTEXT_FACTORY));
env.put(Context.SECURITY_PRINCIPAL, properties.get(Context.SECURITY_PRINCIPAL));
env.put(Context.PROVIDER_URL, properties.get(Context.PROVIDER_URL));
env.put(Context.SECURITY_CREDENTIALS, properties.get(Context.SECURITY_CREDENTIALS));