本文整理汇总了C#中System.ServiceModel.Security.MessagePartSpecification.MakeReadOnly方法的典型用法代码示例。如果您正苦于以下问题:C# MessagePartSpecification.MakeReadOnly方法的具体用法?C# MessagePartSpecification.MakeReadOnly怎么用?C# MessagePartSpecification.MakeReadOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ServiceModel.Security.MessagePartSpecification
的用法示例。
在下文中一共展示了MessagePartSpecification.MakeReadOnly方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UnionReadOnlyPart
public void UnionReadOnlyPart ()
{
MessagePartSpecification s =
new MessagePartSpecification ();
s.MakeReadOnly ();
Assert.AreEqual (true, s.IsReadOnly, "#1");
s.Union (new MessagePartSpecification ());
}
示例2: 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;
}
示例3: 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;
}
}
示例4: 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
示例5: 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;
}