/// <summary> /// Build and initialize an IdmNet Client object ready for use /// </summary> /// <returns>Newly initialized IdmNet Client</returns> public static IdmNetClient BuildClient() { var soapBinding = new IdmSoapBinding(); string fqdn = GetEnvironmentSetting("MIM_fqdn"); var endpointIdentity = EndpointIdentity.CreateSpnIdentity("FIMSERVICE/" + fqdn); var enumerationPath = "http://" + fqdn + SoapConstants.EnumeratePortAndPath; var factoryPath = "http://" + fqdn + SoapConstants.FactoryPortAndPath; var resourcePath = "http://" + fqdn + SoapConstants.ResourcePortAndPath; var enumerationEndpoint = new EndpointAddress(new Uri(enumerationPath), endpointIdentity); var factoryEndpoint = new EndpointAddress(new Uri(factoryPath), endpointIdentity); var resourceEndpoint = new EndpointAddress(new Uri(resourcePath), endpointIdentity); var searchClient = new SearchClient(soapBinding, enumerationEndpoint); var factoryClient = new ResourceFactoryClient(soapBinding, factoryEndpoint); var resourceClient = new ResourceClient(soapBinding, resourceEndpoint); var credentials = new NetworkCredential( GetEnvironmentSetting("MIM_username"), GetEnvironmentSetting("MIM_pwd"), GetEnvironmentSetting("MIM_domain")); searchClient.ClientCredentials.Windows.ClientCredential = credentials; factoryClient.ClientCredentials.Windows.ClientCredential = credentials; resourceClient.ClientCredentials.Windows.ClientCredential = credentials; var it = new IdmNetClient(searchClient, factoryClient, resourceClient); return it; }
/// <summary> /// Build and initialize an IdmNet Client object ready for use /// </summary> /// <returns>Newly initialized IdmNet Client</returns> public static IdmNetClient BuildClient() { var soapBinding = new IdmSoapBinding(); string fqdn = GetEnvironmentSetting("MIM_fqdn"); var endpointIdentity = EndpointIdentity.CreateSpnIdentity("FIMSERVICE/" + fqdn); var enumerationPath = "http://" + fqdn + SoapConstants.EnumeratePortAndPath; var factoryPath = "http://" + fqdn + SoapConstants.FactoryPortAndPath; var resourcePath = "http://" + fqdn + SoapConstants.ResourcePortAndPath; var enumerationEndpoint = new EndpointAddress(new Uri(enumerationPath), endpointIdentity); var factoryEndpoint = new EndpointAddress(new Uri(factoryPath), endpointIdentity); var resourceEndpoint = new EndpointAddress(new Uri(resourcePath), endpointIdentity); var searchClient = new SearchClient(soapBinding, enumerationEndpoint); var factoryClient = new ResourceFactoryClient(soapBinding, factoryEndpoint); var resourceClient = new ResourceClient(soapBinding, resourceEndpoint); var credentials = new NetworkCredential( GetEnvironmentSetting("MIM_username"), GetEnvironmentSetting("MIM_pwd"), GetEnvironmentSetting("MIM_domain")); searchClient.ClientCredentials.Windows.ClientCredential = credentials; factoryClient.ClientCredentials.Windows.ClientCredential = credentials; resourceClient.ClientCredentials.Windows.ClientCredential = credentials; var it = new IdmNetClient(searchClient, factoryClient, resourceClient); return(it); }
/// <summary> /// Primary constructor for the IdmNetClient. Though this is public and can be called, the normal thing to /// do is to use IdmNetClientFactory.BuildClient(). This is available in case you want to build the client /// based on different assumptions made by the factory builder. For example, if you wanted to use a different /// client credentials mechanism, WCF binding, or endpoints /// </summary> /// <param name="searchClient"> /// This is the SOAP client used to connect to Identity Manager for search functionality (WS-Enumeration - /// Enumerate and Pull operations) /// </param> /// <param name="factoryClient"> /// This is the SOAP client used to create new objects/resources in Identity Manager (WS-Transfer - Create /// operation) /// </param> /// <param name="resourceClient"> /// This is the SOAP client used to modify existing objects/resources in Identity Manager /// </param> public IdmNetClient(SearchClient searchClient, ResourceFactoryClient factoryClient, ResourceClient resourceClient) { _searchClient = searchClient; _factoryClient = factoryClient; _resourceClient = resourceClient; }