当前位置: 首页>>代码示例>>C#>>正文


C# MessagePartSpecification.Union方法代码示例

本文整理汇总了C#中System.ServiceModel.Security.MessagePartSpecification.Union方法的典型用法代码示例。如果您正苦于以下问题:C# MessagePartSpecification.Union方法的具体用法?C# MessagePartSpecification.Union怎么用?C# MessagePartSpecification.Union使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ServiceModel.Security.MessagePartSpecification的用法示例。


在下文中一共展示了MessagePartSpecification.Union方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddParts

 private void AddParts(ref MessagePartSpecification parts1, MessagePartSpecification parts2)
 {
     if (parts1 == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("parts1"));
     }
     if (parts2 == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("parts2"));
     }
     if (!parts2.IsEmpty())
     {
         if (parts1.IsReadOnly)
         {
             MessagePartSpecification specification = new MessagePartSpecification();
             specification.Union(parts1);
             specification.Union(parts2);
             parts1 = specification;
         }
         else
         {
             parts1.Union(parts2);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:SecurityBindingElementImporter.cs

示例2: UnionReadOnlyPart

		public void UnionReadOnlyPart ()
		{
			MessagePartSpecification s =
				new MessagePartSpecification ();
			s.MakeReadOnly ();
			Assert.AreEqual (true, s.IsReadOnly, "#1");
			s.Union (new MessagePartSpecification ());
		}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:MessagePartSpecificationTest.cs

示例3: ScopedMessagePartSpecification

        public ScopedMessagePartSpecification(ScopedMessagePartSpecification other)
            : this()
        {
            if (other == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("other"));

            _channelParts.Union(other._channelParts);
            if (other._actionParts != null)
            {
                foreach (string action in other._actionParts.Keys)
                {
                    MessagePartSpecification p = new MessagePartSpecification();
                    p.Union(other._actionParts[action]);
                    _actionParts[action] = p;
                }
            }
        }
开发者ID:weshaggard,项目名称:wcf,代码行数:17,代码来源:ScopedMessagePartSpecification.cs

示例4: ScopedMessagePartSpecification

 public ScopedMessagePartSpecification(ScopedMessagePartSpecification other) : this()
 {
     if (other == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("other"));
     }
     this.channelParts.Union(other.channelParts);
     if (other.actionParts != null)
     {
         foreach (string str in other.actionParts.Keys)
         {
             MessagePartSpecification specification = new MessagePartSpecification();
             specification.Union(other.actionParts[str]);
             this.actionParts[str] = specification;
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:ScopedMessagePartSpecification.cs

示例5: Union

		public void Union ()
		{
			XmlQualifiedName q1, q2, q3;
			q1 = new XmlQualifiedName ("foo");
			q2 = new XmlQualifiedName ("bar");
			q3 = new XmlQualifiedName ("baz");
			MessagePartSpecification p1 =
				new MessagePartSpecification (false, new XmlQualifiedName [] {q1, q2});
			MessagePartSpecification p2 =
				new MessagePartSpecification (true, new XmlQualifiedName [] {q3, q2});
			p1.Union (p2);
			Assert.IsTrue (p1.IsBodyIncluded, "#1");
			// Sigh. It does not exclude duplicates.
			Assert.AreEqual (4, p1.HeaderTypes.Count, "#1-2");
			Assert.IsTrue (p1.HeaderTypes.Contains (q1), "#2");
			Assert.IsTrue (p1.HeaderTypes.Contains (q2), "#3");
			Assert.IsTrue (p1.HeaderTypes.Contains (q3), "#4");
		}
开发者ID:nickchal,项目名称:pash,代码行数:18,代码来源:MessagePartSpecificationTest.cs

示例6: CreateWsspBootstrapPolicyAssertion

        public virtual XmlElement CreateWsspBootstrapPolicyAssertion(MetadataExporter exporter, SecurityBindingElement bootstrapSecurity)
        {
            if (bootstrapSecurity == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bootstrapBinding");

            WSSecurityPolicy sp = WSSecurityPolicy.GetSecurityPolicyDriver(bootstrapSecurity.MessageSecurityVersion);

            // create complete bootstrap binding

            CustomBinding bootstrapBinding = new CustomBinding(bootstrapSecurity);
            if (exporter.State.ContainsKey(SecurityPolicyStrings.SecureConversationBootstrapBindingElementsBelowSecurityKey))
            {
                BindingElementCollection bindingElementsBelowSecurity = exporter.State[SecurityPolicyStrings.SecureConversationBootstrapBindingElementsBelowSecurityKey] as BindingElementCollection;
                if (bindingElementsBelowSecurity != null)
                {
                    foreach (BindingElement be in bindingElementsBelowSecurity)
                    {
                        bootstrapBinding.Elements.Add(be);
                    }
                }
            }

            // generate policy for the "how" of security 

            ServiceEndpoint bootstrapEndpoint = new ServiceEndpoint(NullContract);
            bootstrapEndpoint.Binding = bootstrapBinding;
            PolicyConversionContext policyContext = exporter.ExportPolicy(bootstrapEndpoint);

            // generate policy for the "what" of security (protection assertions)

            // hard-coded requirements in V1: sign and encrypt RST and RSTR body
            ChannelProtectionRequirements bootstrapProtection = new ChannelProtectionRequirements();
            bootstrapProtection.IncomingEncryptionParts.AddParts(new MessagePartSpecification(true));
            bootstrapProtection.OutgoingEncryptionParts.AddParts(new MessagePartSpecification(true));
            bootstrapProtection.IncomingSignatureParts.AddParts(new MessagePartSpecification(true));
            bootstrapProtection.OutgoingSignatureParts.AddParts(new MessagePartSpecification(true));

            // add boostrap binding protection requirements (e.g. addressing headers)
            ChannelProtectionRequirements cpr = bootstrapBinding.GetProperty<ChannelProtectionRequirements>(new BindingParameterCollection());
            if (cpr != null)
            {
                bootstrapProtection.Add(cpr);
            }

            // extract channel-scope protection requirements and union them across request and response
            MessagePartSpecification encryption = new MessagePartSpecification();
            encryption.Union(bootstrapProtection.IncomingEncryptionParts.ChannelParts);
            encryption.Union(bootstrapProtection.OutgoingEncryptionParts.ChannelParts);
            encryption.MakeReadOnly();
            MessagePartSpecification signature = new MessagePartSpecification();
            signature.Union(bootstrapProtection.IncomingSignatureParts.ChannelParts);
            signature.Union(bootstrapProtection.OutgoingSignatureParts.ChannelParts);
            signature.MakeReadOnly();

            // create final boostrap policy assertion

            XmlElement nestedPolicy = CreateWspPolicyWrapper(
                    exporter,
                    sp.CreateWsspSignedPartsAssertion(signature),
                    sp.CreateWsspEncryptedPartsAssertion(encryption));
            foreach (XmlElement e in sp.FilterWsspPolicyAssertions(policyContext.GetBindingAssertions()))
            {
                nestedPolicy.AppendChild(e);
            }
            XmlElement result = CreateWsspAssertion(BootstrapPolicyName);
            result.AppendChild(nestedPolicy);

            return result;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:69,代码来源:WSSecurityPolicy.cs

示例7: MakeReadOnly

 public void MakeReadOnly()
 {
     if (!_isReadOnly)
     {
         _readOnlyNormalizedActionParts = new Dictionary<string, MessagePartSpecification>();
         foreach (string action in _actionParts.Keys)
         {
             MessagePartSpecification p = new MessagePartSpecification();
             p.Union(_actionParts[action]);
             p.Union(_channelParts);
             p.MakeReadOnly();
             _readOnlyNormalizedActionParts[action] = p;
         }
         _isReadOnly = true;
     }
 }
开发者ID:weshaggard,项目名称:wcf,代码行数:16,代码来源:ScopedMessagePartSpecification.cs

示例8: TryGetParts

        public bool TryGetParts(string action, bool excludeChannelScope, out MessagePartSpecification parts)
        {
            if (action == null)
                action = MessageHeaders.WildcardAction;
            parts = null;

            if (_isReadOnly)
            {
                if (_readOnlyNormalizedActionParts.ContainsKey(action))
                    if (excludeChannelScope)
                        parts = _actionParts[action];
                    else
                        parts = _readOnlyNormalizedActionParts[action];
            }
            else if (_actionParts.ContainsKey(action))
            {
                MessagePartSpecification p = new MessagePartSpecification();
                p.Union(_actionParts[action]);
                if (!excludeChannelScope)
                    p.Union(_channelParts);
                parts = p;
            }

            return parts != null;
        }
开发者ID:weshaggard,项目名称:wcf,代码行数:25,代码来源:ScopedMessagePartSpecification.cs

示例9: TryGetParts

 public bool TryGetParts(string action, bool excludeChannelScope, out MessagePartSpecification parts)
 {
     if (action == null)
     {
         action = "*";
     }
     parts = null;
     if (this.isReadOnly)
     {
         if (this.readOnlyNormalizedActionParts.ContainsKey(action))
         {
             if (excludeChannelScope)
             {
                 parts = this.actionParts[action];
             }
             else
             {
                 parts = this.readOnlyNormalizedActionParts[action];
             }
         }
     }
     else if (this.actionParts.ContainsKey(action))
     {
         MessagePartSpecification specification = new MessagePartSpecification();
         specification.Union(this.actionParts[action]);
         if (!excludeChannelScope)
         {
             specification.Union(this.channelParts);
         }
         parts = specification;
     }
     return (parts != null);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:ScopedMessagePartSpecification.cs

示例10: MakeReadOnly

 public void MakeReadOnly()
 {
     if (!this.isReadOnly)
     {
         this.readOnlyNormalizedActionParts = new Dictionary<string, MessagePartSpecification>();
         foreach (string str in this.actionParts.Keys)
         {
             MessagePartSpecification specification = new MessagePartSpecification();
             specification.Union(this.actionParts[str]);
             specification.Union(this.channelParts);
             specification.MakeReadOnly();
             this.readOnlyNormalizedActionParts[str] = specification;
         }
         this.isReadOnly = true;
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:ScopedMessagePartSpecification.cs

示例11: CreateWsspBootstrapPolicyAssertion

 public virtual XmlElement CreateWsspBootstrapPolicyAssertion(MetadataExporter exporter, SecurityBindingElement bootstrapSecurity)
 {
     if (bootstrapSecurity == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bootstrapBinding");
     }
     WSSecurityPolicy securityPolicyDriver = GetSecurityPolicyDriver(bootstrapSecurity.MessageSecurityVersion);
     CustomBinding binding = new CustomBinding(new BindingElement[] { bootstrapSecurity });
     if (exporter.State.ContainsKey("SecureConversationBootstrapBindingElementsBelowSecurityKey"))
     {
         BindingElementCollection elements = exporter.State["SecureConversationBootstrapBindingElementsBelowSecurityKey"] as BindingElementCollection;
         if (elements != null)
         {
             foreach (BindingElement element in elements)
             {
                 binding.Elements.Add(element);
             }
         }
     }
     ServiceEndpoint endpoint = new ServiceEndpoint(NullContract) {
         Binding = binding
     };
     PolicyConversionContext context = exporter.ExportPolicy(endpoint);
     ChannelProtectionRequirements requirements = new ChannelProtectionRequirements();
     requirements.IncomingEncryptionParts.AddParts(new MessagePartSpecification(true));
     requirements.OutgoingEncryptionParts.AddParts(new MessagePartSpecification(true));
     requirements.IncomingSignatureParts.AddParts(new MessagePartSpecification(true));
     requirements.OutgoingSignatureParts.AddParts(new MessagePartSpecification(true));
     ChannelProtectionRequirements property = binding.GetProperty<ChannelProtectionRequirements>(new BindingParameterCollection());
     if (property != null)
     {
         requirements.Add(property);
     }
     MessagePartSpecification parts = new MessagePartSpecification();
     parts.Union(requirements.IncomingEncryptionParts.ChannelParts);
     parts.Union(requirements.OutgoingEncryptionParts.ChannelParts);
     parts.MakeReadOnly();
     MessagePartSpecification specification2 = new MessagePartSpecification();
     specification2.Union(requirements.IncomingSignatureParts.ChannelParts);
     specification2.Union(requirements.OutgoingSignatureParts.ChannelParts);
     specification2.MakeReadOnly();
     XmlElement newChild = this.CreateWspPolicyWrapper(exporter, new XmlElement[] { securityPolicyDriver.CreateWsspSignedPartsAssertion(specification2), securityPolicyDriver.CreateWsspEncryptedPartsAssertion(parts) });
     foreach (XmlElement element3 in securityPolicyDriver.FilterWsspPolicyAssertions(context.GetBindingAssertions()))
     {
         newChild.AppendChild(element3);
     }
     XmlElement element4 = this.CreateWsspAssertion("BootstrapPolicy");
     element4.AppendChild(newChild);
     return element4;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:50,代码来源:WSSecurityPolicy.cs


注:本文中的System.ServiceModel.Security.MessagePartSpecification.Union方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。