public virtual void close() { if (initialContext != null) { try { initialContext.close(); } catch (Exception e) { // ignore LdapPluginLogger.INSTANCE.exceptionWhenClosingLdapCOntext(e); } } }
// ===== Helpers ===== //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void modifyLDAPAttribute(String username, Object credentials, String attribute, Object value) throws Throwable private void ModifyLDAPAttribute(string username, object credentials, string attribute, object value) { string principal = string.Format("cn={0},ou=users,dc=example,dc=com", username); string principal1 = string.Format("cn={0},ou=users,dc=example,dc=com", username); JndiLdapContextFactory contextFactory = new JndiLdapContextFactory(); contextFactory.Url = "ldaps://localhost:10636"; LdapContext ctx = contextFactory.getLdapContext(principal1, credentials); ModificationItem[] mods = new ModificationItem[1]; mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(attribute, value)); // Perform the update ctx.modifyAttributes(principal, mods); ctx.close(); }