Exemplo n.º 1
0
        /// <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;
        }
Exemplo n.º 2
0
        public void It_has_a_parameterless_constructor()
        {
            var it = new IdmSoapBinding();

            Assert.IsFalse(it.Security.Message.EstablishSecurityContext);
            Assert.IsTrue(it.AllowCookies);
            Assert.AreEqual(20000000, it.MaxReceivedMessageSize);
            Assert.AreEqual(20000000, it.MaxBufferPoolSize);
            Assert.AreEqual(32, it.ReaderQuotas.MaxDepth);
            Assert.AreEqual(20000000, it.ReaderQuotas.MaxArrayLength);
            Assert.AreEqual(20000000, it.ReaderQuotas.MaxStringContentLength);
        }