Example #1
0
        public ExtendedProtectionPolicy BuildPolicy()
        {
            if (this.PolicyEnforcement == System.Security.Authentication.ExtendedProtection.PolicyEnforcement.Never)
            {
                return(new ExtendedProtectionPolicy(System.Security.Authentication.ExtendedProtection.PolicyEnforcement.Never));
            }
            ServiceNameCollection        customServiceNames = null;
            ServiceNameElementCollection elements           = this.CustomServiceNames;

            if ((elements != null) && (elements.Count > 0))
            {
                List <string> items = new List <string>(elements.Count);
                foreach (ServiceNameElement element in elements)
                {
                    items.Add(element.Name);
                }
                customServiceNames = new ServiceNameCollection(items);
            }
            return(new ExtendedProtectionPolicy(this.PolicyEnforcement, this.ProtectionScenario, customServiceNames));
        }
        public ExtendedProtectionPolicy BuildPolicy()
        {
            if (PolicyEnforcement == PolicyEnforcement.Never)
            {
                return(new ExtendedProtectionPolicy(PolicyEnforcement.Never));
            }

            ServiceNameCollection spns = null;

            ServiceNameElementCollection spnCollection = CustomServiceNames;

            if (spnCollection != null && spnCollection.Count > 0)
            {
                List <string> spnList = new List <string>(spnCollection.Count);
                foreach (ServiceNameElement element in spnCollection)
                {
                    spnList.Add(element.Name);
                }
                spns = new ServiceNameCollection(spnList);
            }

            return(new ExtendedProtectionPolicy(PolicyEnforcement, ProtectionScenario, spns));
        }