Esempio n. 1
0
        protected virtual T GetCachedProxy <T>(bool secureCalls)
        {
            if (serverContext == null)
            {
                throw new Exception("Server context is not specified");
            }

            Type   t     = typeof(T);
            string key   = t.FullName + ".ServiceProxy";
            T      proxy = (T)Activator.CreateInstance(t);

            object p = proxy;

            // configure proxy
            EnterpriseServerProxyConfigurator cnfg = new EnterpriseServerProxyConfigurator();

            cnfg.EnterpriseServerUrl = serverContext.Server;
            if (secureCalls)
            {
                cnfg.Username = serverContext.Username;
                cnfg.Password = serverContext.Password;
            }

            cnfg.Configure((WebServicesClientProtocol)p);

            return(proxy);
        }
        private void SetupProxy(Microsoft.Web.Services3.WebServicesClientProtocol proxy,
                                string username, string password)
        {
            // create ES configurator
            string serverUrl = ConfigurationManager.AppSettings["AWStats.WebsitePanelAuthenticationProvider.EnterpriseServer"];

            if (String.IsNullOrEmpty(serverUrl))
            {
                throw new Exception("Enterprise Server URL could not be empty");
            }

            EnterpriseServerProxyConfigurator cnfg = new EnterpriseServerProxyConfigurator();

            cnfg.EnterpriseServerUrl = serverUrl;
            cnfg.Username            = username;
            cnfg.Password            = password;
            cnfg.Configure(proxy);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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");
            }
        }
Esempio n. 6
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);
        }