public void Configure(WebServicesClientProtocol proxy)
        {
            // set proxy URL
            string serverUrl = enterpriseServerUrl.Trim();
            if (serverUrl.Length == 0)
                throw new Exception("Enterprise Server URL could not be empty");

            int idx = proxy.Url.LastIndexOf("/");

            // strip the last slash if any
            if (serverUrl[serverUrl.Length - 1] == '/')
                serverUrl = serverUrl.Substring(0, serverUrl.Length - 1);

            proxy.Url = serverUrl + proxy.Url.Substring(idx);

            // set timeout
            proxy.Timeout = 900000; //15 minutes // System.Threading.Timeout.Infinite;

            if (!String.IsNullOrEmpty(username))
            {
                // create assertion
                UsernameAssertion assert = new UsernameAssertion(username, password);

                // apply policy
                Policy policy = new Policy();
                policy.Assertions.Add(assert);

                proxy.SetPolicy(policy);
            }
        }
예제 #2
0
        public static WebServicesClientProtocol ServerInit(WebServicesClientProtocol proxy, ServerProxyConfigurator cnfg, int serverId)
        {
            // get server info
            ServerInfo server = ServerController.GetServerByIdInternal(serverId);

            if (server == null)
            {
                throw new Exception(String.Format("Server with ID {0} was not found", serverId));
            }

            // set AD integration settings
            cnfg.ServerSettings.ADEnabled            = server.ADEnabled;
            cnfg.ServerSettings.ADAuthenticationType = AuthenticationTypes.Secure;
            try
            {
                cnfg.ServerSettings.ADAuthenticationType = (AuthenticationTypes)Enum.Parse(typeof(AuthenticationTypes), server.ADAuthenticationType, true);
            }
            catch { /* ignore */ }
            cnfg.ServerSettings.ADRootDomain             = server.ADRootDomain;
            cnfg.ServerSettings.ADUsername               = server.ADUsername;
            cnfg.ServerSettings.ADPassword               = server.ADPassword;
            cnfg.ServerSettings.ADParentDomain           = server.ADParentDomain;
            cnfg.ServerSettings.ADParentDomainController = server.ADParentDomainController;

            // set timeout
            cnfg.Timeout = ConfigSettings.ServerRequestTimeout;

            return(ServerInit(proxy, cnfg, server.ServerUrl, server.Password));
        }
예제 #3
0
        public static void ApplyAutheticationTicket(WebServicesClientProtocol protocol, string userName, string password)
        {
            UsernameToken token = GetUsernameToken(userName, password, PasswordOption.SendPlainText);

            protocol.SetClientCredential(token);
            protocol.SetPolicy(new TpPolicy());
        }
        public static WebServicesClientProtocol ServerInit(WebServicesClientProtocol proxy, ServerProxyConfigurator cnfg, int serverId)
        {
            // get server info
            ServerInfo server = ServerController.GetServerByIdInternal(serverId);

            if (server == null)
                throw new Exception(String.Format("Server with ID {0} was not found", serverId));

            // set AD integration settings
            cnfg.ServerSettings.ADEnabled = server.ADEnabled;
            cnfg.ServerSettings.ADAuthenticationType = AuthenticationTypes.Secure;
            try
            {
                cnfg.ServerSettings.ADAuthenticationType = (AuthenticationTypes)Enum.Parse(typeof(AuthenticationTypes), server.ADAuthenticationType, true);
            }
            catch { /* ignore */ }
            cnfg.ServerSettings.ADRootDomain = server.ADRootDomain;
            cnfg.ServerSettings.ADUsername = server.ADUsername;
            cnfg.ServerSettings.ADPassword = server.ADPassword;

            // set timeout
            cnfg.Timeout = ConfigSettings.ServerRequestTimeout;

            return ServerInit(proxy, cnfg, server.ServerUrl, server.Password);
        }
예제 #5
0
        public void Configure(WebServicesClientProtocol proxy)
        {
            // set proxy URL
            string serverUrl = _serverUrl.Trim();

            if (serverUrl.Length == 0)
            {
                throw new Exception("Enterprise Server URL could not be empty");
            }

            int idx = proxy.Url.LastIndexOf("/");

            // strip the last slash if any
            if (serverUrl[serverUrl.Length - 1] == '/')
            {
                serverUrl = serverUrl.Substring(0, serverUrl.Length - 1);
            }

            proxy.Url = serverUrl + proxy.Url.Substring(idx);

            // set timeout
            proxy.Timeout = 900000;             //15 minutes // System.Threading.Timeout.Infinite;

            if (_securityPolicy != null)
            {
                proxy.SetPolicy(_securityPolicy);
            }
        }
예제 #6
0
        public static WebServicesClientProtocol Init(WebServicesClientProtocol proxy, int serviceId)
        {
            ServerProxyConfigurator cnfg = new ServerProxyConfigurator();

            // get service
            ServiceInfo service = ServerController.GetServiceInfo(serviceId);

            if (service == null)
            {
                throw new Exception(String.Format("Service with ID {0} was not found", serviceId));
            }

            // set service settings
            StringDictionary serviceSettings = ServerController.GetServiceSettings(serviceId);

            foreach (string key in serviceSettings.Keys)
            {
                cnfg.ProviderSettings.Settings[key] = serviceSettings[key];
            }

            // get provider
            ProviderInfo provider = ServerController.GetProvider(service.ProviderId);

            cnfg.ProviderSettings.ProviderGroupID = provider.GroupId;
            cnfg.ProviderSettings.ProviderCode    = provider.ProviderName;
            cnfg.ProviderSettings.ProviderName    = provider.DisplayName;
            cnfg.ProviderSettings.ProviderType    = provider.ProviderType;

            // init service on the server level
            return(ServerInit(proxy, cnfg, service.ServerId));
        }
        public static WebServicesClientProtocol Init(WebServicesClientProtocol proxy, int serviceId)
        {
            ServerProxyConfigurator cnfg = new ServerProxyConfigurator();

            // get service
            ServiceInfo service = ServerController.GetServiceInfo(serviceId);

            if (service == null)
                throw new Exception(String.Format("Service with ID {0} was not found", serviceId));

            // set service settings
            StringDictionary serviceSettings = ServerController.GetServiceSettings(serviceId);
            foreach (string key in serviceSettings.Keys)
                cnfg.ProviderSettings.Settings[key] = serviceSettings[key];

            // get provider
            ProviderInfo provider = ServerController.GetProvider(service.ProviderId);
            cnfg.ProviderSettings.ProviderGroupID = provider.GroupId;
            cnfg.ProviderSettings.ProviderCode = provider.ProviderName;
            cnfg.ProviderSettings.ProviderName = provider.DisplayName;
            cnfg.ProviderSettings.ProviderType = provider.ProviderType;

            // init service on the server level
            return ServerInit(proxy, cnfg, service.ServerId);
        }
        public void Configure(WebServicesClientProtocol proxy)
        {
            // configure proxy URL
            if (!String.IsNullOrEmpty(serverUrl))
            {
                if (serverUrl.EndsWith("/"))
                    serverUrl = serverUrl.Substring(0, serverUrl.Length - 1);

                proxy.Url = serverUrl + proxy.Url.Substring(proxy.Url.LastIndexOf('/'));
            }

            // set proxy timeout
            proxy.Timeout = (timeout == -1) ? System.Threading.Timeout.Infinite : timeout * 1000;

            // setup security assertion
            if (!String.IsNullOrEmpty(serverPassword))
            {
                ServerUsernameAssertion assert
                    = new ServerUsernameAssertion(ServerSettings.ServerId, serverPassword);

                // create policy
                Policy policy = new Policy();
                policy.Assertions.Add(assert);

                proxy.SetPolicy(policy);
            }

            // provider settings
            ServiceProviderSettingsSoapHeader settingsHeader = new ServiceProviderSettingsSoapHeader();
            List<string> settings = new List<string>();
            
            // AD Settings
            settings.Add("AD:Enabled=" + ServerSettings.ADEnabled.ToString());
            settings.Add("AD:AuthenticationType=" + ServerSettings.ADAuthenticationType.ToString());
            settings.Add("AD:RootDomain=" + ServerSettings.ADRootDomain);
            settings.Add("AD:Username="******"AD:Password="******"Server:ServerId=" + ServerSettings.ServerId);
            settings.Add("Server:ServerName=" + ServerSettings.ServerName);

            // Provider Settings
            settings.Add("Provider:ProviderGroupID=" + ProviderSettings.ProviderGroupID.ToString());
            settings.Add("Provider:ProviderCode=" + ProviderSettings.ProviderCode);
            settings.Add("Provider:ProviderName=" + ProviderSettings.ProviderName);
            settings.Add("Provider:ProviderType=" + ProviderSettings.ProviderType);

            // Custom Provider Settings
            foreach (string settingName in ProviderSettings.Settings.Keys)
            {
                settings.Add(settingName + "=" + ProviderSettings.Settings[settingName]);
            }

            // set header
            settingsHeader.Settings = settings.ToArray();
            FieldInfo field = proxy.GetType().GetField("ServiceProviderSettingsSoapHeaderValue");
            if (field != null)
                field.SetValue(proxy, settingsHeader);
        }
        public void Configure(WebServicesClientProtocol proxy)
        {
            // set proxy URL
            string serverUrl = enterpriseServerUrl.Trim();

            if (serverUrl.Length == 0)
            {
                throw new Exception("Enterprise Server URL could not be empty");
            }

            int idx = proxy.Url.LastIndexOf("/");

            // strip the last slash if any
            if (serverUrl[serverUrl.Length - 1] == '/')
            {
                serverUrl = serverUrl.Substring(0, serverUrl.Length - 1);
            }

            proxy.Url = serverUrl + proxy.Url.Substring(idx);

            // set timeout
            proxy.Timeout = 900000; //15 minutes // System.Threading.Timeout.Infinite;

            if (!String.IsNullOrEmpty(username))
            {
                // create assertion
                UsernameAssertion assert = new UsernameAssertion(username, password);

                // apply policy
                Policy policy = new Policy();
                policy.Assertions.Add(assert);

                proxy.SetPolicy(policy);
            }
        }
예제 #10
0
        /// <summary>
        /// 对某个WS进行初始化
        /// </summary>
        /// <param name="ws"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        public static void Init(WebServicesClientProtocol ws, string username, string password)
        {
            AppContext.UserName = username;
            AppContext.Password = password;

            Policy policy = new Policy();
            policy.Assertions.Add(new MyAssertion());
            ws.SetPolicy(policy);
        }
예제 #11
0
        /// <summary>
        /// 对某个WS进行初始化
        /// </summary>
        /// <param name="ws"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        public static void Init(WebServicesClientProtocol ws, string username, string password)
        {
            AppContext.UserName = username;
            AppContext.Password = password;

            Policy policy = new Policy();

            policy.Assertions.Add(new MyAssertion());
            ws.SetPolicy(policy);
        }
예제 #12
0
        private static WebServicesClientProtocol ServerInit(WebServicesClientProtocol proxy,
                                                            ServerProxyConfigurator cnfg, string serverUrl, string serverPassword)
        {
            // set URL & password
            cnfg.ServerUrl      = serverUrl;
            cnfg.ServerPassword = serverPassword;

            // configure proxy!
            cnfg.Configure(proxy);

            return(proxy);
        }
예제 #13
0
        private static void serviceClientSetting(WebServicesClientProtocol serviceClient, string url, string username = null, string password = null, int timeout = -1)
        {
            serviceClient.Url = url;
            /* timeout is 0 if config verb EBSServiceTimeout is not defined.
             * It is set at the _sr_client CS_SERVICEREQUEST_PUB_Service() instance
             * level, so all the ws calls (from this proxy client) have this timeout setting
             */
            serviceClient.Timeout = timeout == 0 ? -1 : timeout;

            if (!String.IsNullOrWhiteSpace(username) && !String.IsNullOrWhiteSpace(password))
            {
                // add wsse:Security headers.                    
                UsernameToken userNameToken = new UsernameToken(username, password, PasswordOption.SendPlainText);
                SoapContext soapContext = serviceClient.RequestSoapContext;
                soapContext.Security.Tokens.Add(userNameToken);
            }
        }
예제 #14
0
        private void EncryptMessage(WebServicesClientProtocol oWSProxy)
        {
            X509SecurityToken encryptToken = new X509SecurityToken(this.EncryptTokenCertificate);

            if (!encryptToken.SupportsDataEncryption)
            {
                throw new CryptographicException("Certificate for encryption must support data encryption.");
            }

            if (encryptToken.IsExpired)
            {
                throw new CryptographicException("Certificate for signature is expired.");
            }

            oWSProxy.RequestSoapContext.Security.Tokens.Add(encryptToken);
            oWSProxy.RequestSoapContext.Security.Elements.Add(new EncryptedData(encryptToken));
        }
예제 #15
0
        private void AddSignature(WebServicesClientProtocol oWSProxy)
        {
            SecurityToken signingToken = new X509SecurityToken(this.SigningTokenCertificate);

            if (!signingToken.SupportsDigitalSignature)
            {
                throw new CryptographicException("Certificate for signature must support digital signatures and have a private key available.");
            }

            if (signingToken.IsExpired)
            {
                throw new CryptographicException("Certificate for signature is expired.");
            }

            //Add the signature element to a security section on the request to sign the request
            oWSProxy.RequestSoapContext.Security.Tokens.Add(signingToken);
            oWSProxy.RequestSoapContext.Security.Elements.Add(new MessageSignature(signingToken));
        }
예제 #16
0
파일: WSP.cs 프로젝트: vkuttyp/websitepanel
        public void ConfigureEnterpriseServerProxy(WebServicesClientProtocol proxy, bool applyPolicy)
        {
            // load ES properties
            string serverUrl = WebDavAppConfigManager.Instance.EnterpriseServerUrl;

            EnterpriseServerProxyConfigurator cnfg = new EnterpriseServerProxyConfigurator();

            cnfg.EnterpriseServerUrl = serverUrl;

            // create assertion
            if (applyPolicy)
            {
                cnfg.Username = WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Login;
                cnfg.Password = _cryptography.Decrypt(WebDavAppConfigManager.Instance.WebsitePanelConstantUserParameters.Password);
            }

            cnfg.Configure(proxy);
        }
예제 #17
0
        private static void serviceClientSetting(WebServicesClientProtocol serviceClient, string url, string username = null, string password = null, int timeout = -1)
        {
            serviceClient.Url = url;

            /* timeout is 0 if config verb EBSServiceTimeout is not defined.
             * It is set at the _sr_client CS_SERVICEREQUEST_PUB_Service() instance
             * level, so all the ws calls (from this proxy client) have this timeout setting
             */
            serviceClient.Timeout = timeout == 0 ? -1 : timeout;

            if (!String.IsNullOrWhiteSpace(username) && !String.IsNullOrWhiteSpace(password))
            {
                // add wsse:Security headers.
                UsernameToken userNameToken = new UsernameToken(username, password, PasswordOption.SendPlainText);
                SoapContext   soapContext   = serviceClient.RequestSoapContext;
                soapContext.Security.Tokens.Add(userNameToken);
            }
        }
예제 #18
0
		public static void RunServiceAsSpaceOwner(WebServicesClientProtocol proxy)
		{
			// impersonate as space owner
			string username = EcommerceSettings.GetSetting("OwnerUsername");
			string password = EcommerceSettings.GetSetting("OwnerPassword");

			if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password))
			{
				EnterpriseServerProxyConfigurator config = new EnterpriseServerProxyConfigurator();

				config.EnterpriseServerUrl = EcommerceSettings.GetSetting("EnterpriseServer");
				config.Username = username;
				config.Password = password;

				config.Configure(proxy);
			}
			else
				throw new Exception("Ecommerce doesn't configured correctly, please review SitesSettings/Ecommerce section");
		}
예제 #19
0
        public static void RunServiceAsSpaceOwner(WebServicesClientProtocol proxy)
        {
            // impersonate as space owner
            string username = EcommerceSettings.GetSetting("OwnerUsername");
            string password = EcommerceSettings.GetSetting("OwnerPassword");

            if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password))
            {
                EnterpriseServerProxyConfigurator config = new EnterpriseServerProxyConfigurator();

                config.EnterpriseServerUrl = EcommerceSettings.GetSetting("EnterpriseServer");
                config.Username            = username;
                config.Password            = password;

                config.Configure(proxy);
            }
            else
            {
                throw new Exception("Ecommerce doesn't configured correctly, please review SitesSettings/Ecommerce section");
            }
        }
예제 #20
0
		public void Configure(WebServicesClientProtocol proxy)
		{
			// set proxy URL
			string serverUrl = _serverUrl.Trim();
			if (serverUrl.Length == 0)
				throw new Exception("Enterprise Server URL could not be empty");

			int idx = proxy.Url.LastIndexOf("/");

			// strip the last slash if any
			if (serverUrl[serverUrl.Length - 1] == '/')
				serverUrl = serverUrl.Substring(0, serverUrl.Length - 1);

			proxy.Url = serverUrl + proxy.Url.Substring(idx);

			// set timeout
			proxy.Timeout = 900000; //15 minutes // System.Threading.Timeout.Infinite;

			if (_securityPolicy != null)
				proxy.SetPolicy(_securityPolicy);
		}
예제 #21
0
        public static void ConfigureEnterpriseServerProxy(WebServicesClientProtocol proxy, bool applyPolicy)
        {
            // load ES properties
            string serverUrl = PortalConfiguration.SiteSettings["EnterpriseServer"];

            EnterpriseServerProxyConfigurator cnfg = new EnterpriseServerProxyConfigurator();

            cnfg.EnterpriseServerUrl = serverUrl;

            // create assertion
            if (applyPolicy)
            {
                if (AuthTicket != null)
                {
                    cnfg.Username = AuthTicket.Name;
                    cnfg.Password = AuthTicket.UserData.Substring(0, AuthTicket.UserData.IndexOf(Environment.NewLine));
                }
            }

            cnfg.Configure(proxy);
        }
예제 #22
0
        public static void Configure(WebServicesClientProtocol proxy, bool applyPolicy)
        {
            if (applyPolicy && !HttpContext.Current.Request.IsAuthenticated)
            {
                // impersonate as space owner
                string username = EcommerceSettings.GetSetting("OwnerUsername");
                string password = EcommerceSettings.GetSetting("OwnerPassword");

                if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password))
                {
                    EnterpriseServerProxyConfigurator config = new EnterpriseServerProxyConfigurator();

                    config.EnterpriseServerUrl = EcommerceSettings.GetSetting("EnterpriseServer");
                    config.Username            = username;
                    config.Password            = password;

                    config.Configure(proxy);

                    return;
                }
            }

            PortalUtils.ConfigureEnterpriseServerProxy(proxy, applyPolicy);
        }
예제 #23
0
		public static void Configure(WebServicesClientProtocol proxy, bool applyPolicy)
		{
			if (applyPolicy && !HttpContext.Current.Request.IsAuthenticated)
			{
				// impersonate as space owner
				string username = EcommerceSettings.GetSetting("OwnerUsername");
				string password = EcommerceSettings.GetSetting("OwnerPassword");

				if (!String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(password))
				{
					EnterpriseServerProxyConfigurator config = new EnterpriseServerProxyConfigurator();

					config.EnterpriseServerUrl = EcommerceSettings.GetSetting("EnterpriseServer");
					config.Username = username;
					config.Password = password;

					config.Configure(proxy);

					return;
				}
			}
			
			PortalUtils.ConfigureEnterpriseServerProxy(proxy, applyPolicy);
        }
예제 #24
0
 public static void Configure(WebServicesClientProtocol proxy)
 {
     Configure(proxy, true);
 }
예제 #25
0
 public static WebServicesClientProtocol ServerInit(WebServicesClientProtocol proxy, int serverId)
 {
     return(ServerInit(proxy, new ServerProxyConfigurator(), serverId));
 }
예제 #26
0
 public static WebServicesClientProtocol ServerInit(WebServicesClientProtocol proxy,
                                                    string serverUrl, string serverPassword)
 {
     return(ServerInit(proxy, new ServerProxyConfigurator(), serverUrl, serverPassword));
 }
예제 #27
0
		public static void Configure(WebServicesClientProtocol proxy)
		{
			Configure(proxy, true);
		}
예제 #28
0
 public static void ConfigureEnterpriseServerProxy(WebServicesClientProtocol proxy)
 {
     ConfigureEnterpriseServerProxy(proxy, true);
 }
		public static void ApplyAutheticationTicket(WebServicesClientProtocol protocol, string userName, string password)
		{
			var token = GetUsernameToken(userName, password, PasswordOption.SendPlainText);
			protocol.SetClientCredential(token);
			protocol.SetPolicy(new TpServicePolicy());
		}
예제 #30
0
        public static void ConfigureEnterpriseServerProxy(WebServicesClientProtocol proxy, bool applyPolicy)
        {
            // load ES properties
            string serverUrl = PortalConfiguration.SiteSettings["EnterpriseServer"];

            EnterpriseServerProxyConfigurator cnfg = new EnterpriseServerProxyConfigurator();
            cnfg.EnterpriseServerUrl = serverUrl;

            // create assertion
            if (applyPolicy)
            {
                if (AuthTicket != null)
                {
                    cnfg.Username = AuthTicket.Name;
                    cnfg.Password = AuthTicket.UserData.Substring(0, AuthTicket.UserData.IndexOf(Environment.NewLine));
                }
            }

            cnfg.Configure(proxy);
        }
예제 #31
0
 public static void ConfigureEnterpriseServerProxy(WebServicesClientProtocol proxy)
 {
     ConfigureEnterpriseServerProxy(proxy, true);
 }
 public static WebServicesClientProtocol ServerInit(WebServicesClientProtocol proxy,
     string serverUrl, string serverPassword)
 {
     return ServerInit(proxy, new ServerProxyConfigurator(), serverUrl, serverPassword);
 }
 public static WebServicesClientProtocol ServerInit(WebServicesClientProtocol proxy, int serverId)
 {
     return ServerInit(proxy, new ServerProxyConfigurator(), serverId);
 }
예제 #34
0
        public void Configure(WebServicesClientProtocol proxy)
        {
            // configure proxy URL
            if (!String.IsNullOrEmpty(serverUrl))
            {
                if (serverUrl.EndsWith("/"))
                {
                    serverUrl = serverUrl.Substring(0, serverUrl.Length - 1);
                }

                proxy.Url = serverUrl + proxy.Url.Substring(proxy.Url.LastIndexOf('/'));
            }

            // set proxy timeout
            proxy.Timeout = (timeout == -1) ? System.Threading.Timeout.Infinite : timeout * 1000;

            // setup security assertion
            if (!String.IsNullOrEmpty(serverPassword))
            {
                ServerUsernameAssertion assert
                    = new ServerUsernameAssertion(ServerSettings.ServerId, serverPassword);

                // create policy
                Policy policy = new Policy();
                policy.Assertions.Add(assert);

                proxy.SetPolicy(policy);
            }

            // provider settings
            ServiceProviderSettingsSoapHeader settingsHeader = new ServiceProviderSettingsSoapHeader();
            List <string> settings = new List <string>();

            // AD Settings
            settings.Add("AD:Enabled=" + ServerSettings.ADEnabled.ToString());
            settings.Add("AD:AuthenticationType=" + ServerSettings.ADAuthenticationType.ToString());
            settings.Add("AD:RootDomain=" + ServerSettings.ADRootDomain);
            settings.Add("AD:Username="******"AD:Password="******"Server:ServerId=" + ServerSettings.ServerId);
            settings.Add("Server:ServerName=" + ServerSettings.ServerName);

            // Provider Settings
            settings.Add("Provider:ProviderGroupID=" + ProviderSettings.ProviderGroupID.ToString());
            settings.Add("Provider:ProviderCode=" + ProviderSettings.ProviderCode);
            settings.Add("Provider:ProviderName=" + ProviderSettings.ProviderName);
            settings.Add("Provider:ProviderType=" + ProviderSettings.ProviderType);

            // Custom Provider Settings
            foreach (string settingName in ProviderSettings.Settings.Keys)
            {
                settings.Add(settingName + "=" + ProviderSettings.Settings[settingName]);
            }

            // set header
            settingsHeader.Settings = settings.ToArray();
            FieldInfo field = proxy.GetType().GetField("ServiceProviderSettingsSoapHeaderValue");

            if (field != null)
            {
                field.SetValue(proxy, settingsHeader);
            }
        }
        private static WebServicesClientProtocol ServerInit(WebServicesClientProtocol proxy,
            ServerProxyConfigurator cnfg, string serverUrl, string serverPassword)
        {
            // set URL & password
            cnfg.ServerUrl = serverUrl;
            cnfg.ServerPassword = serverPassword;

            // configure proxy!
            cnfg.Configure(proxy);

            return proxy;
        }