public ActiveDirectoryChangeTrigger(ManagementAgent ma) { if (!ActiveDirectoryChangeTrigger.CanCreateForMA(ma)) { throw new InvalidOperationException("The specified management agent is not an AD or LDS management agent"); } this.LastLogonTimestampOffset = new TimeSpan(0, 5, 0); this.MinimumIntervalBetweenEvents = new TimeSpan(0, 1, 0); this.UseExplicitCredentials = false; string privateData = ma.ExportManagementAgent(); XmlDocument d = new XmlDocument(); d.LoadXml(privateData); XmlNode partitionNode = d.SelectSingleNode("/export-ma/ma-data/ma-partition-data/partition[selected=1 and custom-data/adma-partition-data[is-domain=1]]"); if (partitionNode == null) { return; } this.HostName = partitionNode.SelectSingleNode("custom-data/adma-partition-data/name")?.InnerText; this.BaseDN = partitionNode.SelectSingleNode("custom-data/adma-partition-data/dn")?.InnerText; this.ObjectClasses = partitionNode.SelectNodes("filter/object-classes/object-class")?.OfType <XmlElement>().Where(t => t.InnerText != "container" && t.InnerText != "domainDNS" && t.InnerText != "organizationalUnit").Select(u => u.InnerText).ToArray(); }
public NetworkCredential GetCredentialPackage() { if (!this.HasCredentials) { return(null); } return(new NetworkCredential(ActiveDirectoryChangeTrigger.GetUserNameFromFullyQualifiedName(this.Username), this.Password?.Value, ActiveDirectoryChangeTrigger.GetDomainOrNullFromFullyQualifiedName(this.Username))); }
internal static void AddDefaultTriggers(MAControllerConfiguration config, ManagementAgent ma) { switch (ma.Category) { case "FIM": FimServicePendingImportTrigger t1 = new FimServicePendingImportTrigger(ma); config.Triggers.Add(t1); break; case "ADAM": case "AD": ActiveDirectoryChangeTrigger t2 = new ActiveDirectoryChangeTrigger(ma); config.Triggers.Add(t2); break; } }