本文整理汇总了C#中System.ServiceModel.Description.MetadataExporter类的典型用法代码示例。如果您正苦于以下问题:C# MetadataExporter类的具体用法?C# MetadataExporter怎么用?C# MetadataExporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetadataExporter类属于System.ServiceModel.Description命名空间,在下文中一共展示了MetadataExporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMsspSslContextTokenAssertion
public override XmlElement CreateMsspSslContextTokenAssertion(MetadataExporter exporter, SslSecurityTokenParameters parameters)
{
XmlElement tokenAssertion = this.CreateMsspAssertion("SslContextToken");
this.SetIncludeTokenValue(tokenAssertion, parameters.InclusionMode);
tokenAssertion.AppendChild(this.CreateWspPolicyWrapper(exporter, new XmlElement[] { this.CreateWsspRequireDerivedKeysAssertion(parameters.RequireDerivedKeys), this.CreateWsspMustNotSendCancelAssertion(false), this.CreateMsspRequireClientCertificateAssertion(parameters.RequireClientCertificate), this.CreateWsspMustNotSendAmendAssertion(), this.CreateWsspMustNotSendRenewAssertion() }));
return tokenAssertion;
}
示例2: CreateWsspHttpsTokenAssertion
public override XmlElement CreateWsspHttpsTokenAssertion(MetadataExporter exporter, HttpsTransportBindingElement httpsBinding)
{
Fx.Assert(httpsBinding != null, "httpsBinding must not be null.");
Fx.Assert(httpsBinding.AuthenticationScheme.IsSingleton(), "authenticationScheme must be a singleton value for security-mode TransportWithMessageCredential.");
XmlElement result = CreateWsspAssertion(WSSecurityPolicy.HttpsTokenName);
if (httpsBinding.RequireClientCertificate ||
httpsBinding.AuthenticationScheme == AuthenticationSchemes.Basic ||
httpsBinding.AuthenticationScheme == AuthenticationSchemes.Digest)
{
XmlElement policy = CreateWspPolicyWrapper(exporter);
if (httpsBinding.RequireClientCertificate)
{
policy.AppendChild(CreateWsspAssertion(WSSecurityPolicy.RequireClientCertificateName));
}
if (httpsBinding.AuthenticationScheme == AuthenticationSchemes.Basic)
{
policy.AppendChild(CreateWsspAssertion(WSSecurityPolicy.HttpBasicAuthenticationName));
}
else if (httpsBinding.AuthenticationScheme == AuthenticationSchemes.Digest)
{
policy.AppendChild(CreateWsspAssertion(WSSecurityPolicy.HttpDigestAuthenticationName));
}
result.AppendChild(policy);
}
return result;
}
示例3: CreateWsspSignedEncryptedSupportingTokensAssertion
private XmlElement CreateWsspSignedEncryptedSupportingTokensAssertion(MetadataExporter exporter, Collection<SecurityTokenParameters> signedEncrypted, Collection<SecurityTokenParameters> optionalSignedEncrypted)
{
if (((signedEncrypted == null) || (signedEncrypted.Count == 0)) && ((optionalSignedEncrypted == null) || (optionalSignedEncrypted.Count == 0)))
{
return null;
}
XmlElement newChild = this.CreateWspPolicyWrapper(exporter, new XmlElement[0]);
if (signedEncrypted != null)
{
foreach (SecurityTokenParameters parameters in signedEncrypted)
{
newChild.AppendChild(this.CreateTokenAssertion(exporter, parameters));
}
}
if (optionalSignedEncrypted != null)
{
foreach (SecurityTokenParameters parameters2 in optionalSignedEncrypted)
{
newChild.AppendChild(this.CreateTokenAssertion(exporter, parameters2, true));
}
}
XmlElement element = this.CreateWsspAssertion("SignedEncryptedSupportingTokens");
element.AppendChild(newChild);
return element;
}
示例4: CreateWsspSecureConversationTokenAssertion
public override XmlElement CreateWsspSecureConversationTokenAssertion(MetadataExporter exporter, SecureConversationSecurityTokenParameters parameters)
{
XmlElement tokenAssertion = this.CreateWsspAssertion("SecureConversationToken");
this.SetIncludeTokenValue(tokenAssertion, parameters.InclusionMode);
tokenAssertion.AppendChild(this.CreateWspPolicyWrapper(exporter, new XmlElement[] { this.CreateWsspRequireDerivedKeysAssertion(parameters.RequireDerivedKeys), this.CreateWsspMustNotSendCancelAssertion(parameters.RequireCancellation), this.CreateWsspBootstrapPolicyAssertion(exporter, parameters.BootstrapSecurityBindingElement), this.CreateWsspMustNotSendAmendAssertion(), (!parameters.RequireCancellation || !parameters.CanRenewSession) ? this.CreateWsspMustNotSendRenewAssertion() : null }));
return tokenAssertion;
}
示例5: OnExportPolicy
internal void OnExportPolicy(MetadataExporter exporter, PolicyConversionContext context)
{
string str = "";
switch (this.Mode)
{
case SecurityMode.None:
str = "PeerTransportSecurityModeNone";
break;
case SecurityMode.Transport:
str = "PeerTransportSecurityModeTransport";
break;
case SecurityMode.Message:
str = "PeerTransportSecurityModeMessage";
break;
case SecurityMode.TransportWithMessageCredential:
str = "PeerTransportSecurityModeTransportWithMessageCredential";
break;
default:
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
}
XmlElement item = new XmlDocument().CreateElement("pc", "PeerTransportSecurityMode", "http://schemas.microsoft.com/soap/peer");
item.InnerText = str;
context.GetBindingAssertions().Add(item);
this.transportSecurity.OnExportPolicy(exporter, context);
}
示例6: OnExportPolicy
internal void OnExportPolicy(MetadataExporter exporter, PolicyConversionContext context)
{
string str = "";
switch (this.CredentialType)
{
case PeerTransportCredentialType.Password:
str = "PeerTransportCredentialTypePassword";
break;
case PeerTransportCredentialType.Certificate:
str = "PeerTransportCredentialTypeCertificate";
break;
default:
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
}
XmlElement item = new XmlDocument().CreateElement("pc", "PeerTransportCredentialType", "http://schemas.microsoft.com/soap/peer");
item.InnerText = str;
context.GetBindingAssertions().Add(item);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:PeerTransportSecuritySettings.cs
示例7: OnExportPolicy
internal void OnExportPolicy(MetadataExporter exporter, PolicyConversionContext context)
{
string assertion = "";
switch (this.CredentialType)
{
case PeerTransportCredentialType.Password:
assertion = PeerTransportPolicyConstants.PeerTransportCredentialTypePassword;
break;
case PeerTransportCredentialType.Certificate:
assertion = PeerTransportPolicyConstants.PeerTransportCredentialTypeCertificate;
break;
default:
Fx.Assert("Unsupported value for PeerTransportSecuritySettings.CredentialType");
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException());
}
XmlDocument doc = new XmlDocument();
XmlElement element = doc.CreateElement(PeerTransportPolicyConstants.PeerTransportPrefix,
PeerTransportPolicyConstants.PeerTransportCredentialType,
TransportPolicyConstants.PeerTransportUri);
element.InnerText = assertion;
context.GetBindingAssertions().Add(element);
}
示例8: CreateWsspHttpsTokenAssertion
public override XmlElement CreateWsspHttpsTokenAssertion(MetadataExporter exporter, HttpsTransportBindingElement httpsBinding)
{
XmlElement element = this.CreateWsspAssertion("HttpsToken");
if ((httpsBinding.RequireClientCertificate || (httpsBinding.AuthenticationScheme == AuthenticationSchemes.Basic)) || (httpsBinding.AuthenticationScheme == AuthenticationSchemes.Digest))
{
XmlElement newChild = this.CreateWspPolicyWrapper(exporter, new XmlElement[0]);
if (httpsBinding.RequireClientCertificate)
{
newChild.AppendChild(this.CreateWsspAssertion("RequireClientCertificate"));
}
if (httpsBinding.AuthenticationScheme == AuthenticationSchemes.Basic)
{
newChild.AppendChild(this.CreateWsspAssertion("HttpBasicAuthentication"));
}
else if (httpsBinding.AuthenticationScheme == AuthenticationSchemes.Digest)
{
newChild.AppendChild(this.CreateWsspAssertion("HttpDigestAuthentication"));
}
element.AppendChild(newChild);
}
return element;
}
示例9: CreateWsspSignedEndorsingSupportingTokensAssertion
protected XmlElement CreateWsspSignedEndorsingSupportingTokensAssertion(MetadataExporter exporter, Collection<SecurityTokenParameters> signedEndorsing, Collection<SecurityTokenParameters> optionalSignedEndorsing, AddressingVersion addressingVersion)
{
return CreateWsspiSupportingTokensAssertion(exporter, signedEndorsing, optionalSignedEndorsing, addressingVersion, SignedEndorsingSupportingTokensName);
}
示例10: CreateWsspSupportingTokensAssertion
public virtual Collection<XmlElement> CreateWsspSupportingTokensAssertion(MetadataExporter exporter, Collection<SecurityTokenParameters> signed, Collection<SecurityTokenParameters> signedEncrypted, Collection<SecurityTokenParameters> endorsing, Collection<SecurityTokenParameters> signedEndorsing, Collection<SecurityTokenParameters> optionalSigned, Collection<SecurityTokenParameters> optionalSignedEncrypted, Collection<SecurityTokenParameters> optionalEndorsing, Collection<SecurityTokenParameters> optionalSignedEndorsing, AddressingVersion addressingVersion)
{
Collection<XmlElement> supportingTokenAssertions = new Collection<XmlElement>();
// Signed Supporting Tokens
XmlElement supportingTokenAssertion = CreateWsspSignedSupportingTokensAssertion(exporter, signed, signedEncrypted, optionalSigned, optionalSignedEncrypted);
if (supportingTokenAssertion != null)
supportingTokenAssertions.Add(supportingTokenAssertion);
// Endorsing Supporting Tokens.
supportingTokenAssertion = CreateWsspEndorsingSupportingTokensAssertion(exporter, endorsing, optionalEndorsing, addressingVersion);
if (supportingTokenAssertion != null)
supportingTokenAssertions.Add(supportingTokenAssertion);
// Signed Endorsing Supporting Tokens.
supportingTokenAssertion = CreateWsspSignedEndorsingSupportingTokensAssertion(exporter, signedEndorsing, optionalSignedEndorsing, addressingVersion);
if (supportingTokenAssertion != null)
supportingTokenAssertions.Add(supportingTokenAssertion);
return supportingTokenAssertions;
}
示例11: CreateWsspTrustAssertion
protected XmlElement CreateWsspTrustAssertion(string trustName, MetadataExporter exporter, SecurityKeyEntropyMode keyEntropyMode)
{
XmlElement result = CreateWsspAssertion(trustName);
result.AppendChild(
CreateWspPolicyWrapper(
exporter,
CreateWsspAssertion(MustSupportIssuedTokensName),
CreateWsspRequireClientEntropyAssertion(keyEntropyMode),
CreateWsspRequireServerEntropyAssertion(keyEntropyMode)
));
return result;
}
示例12: CreateWsspWss11Assertion
public virtual XmlElement CreateWsspWss11Assertion(MetadataExporter exporter, bool requireSignatureConfirmation)
{
XmlElement result = CreateWsspAssertion(Wss11Name);
result.AppendChild(
CreateWspPolicyWrapper(
exporter,
CreateWsspAssertionMustSupportRefKeyIdentifierName(),
CreateWsspAssertionMustSupportRefIssuerSerialName(),
CreateWsspAssertionMustSupportRefThumbprintName(),
CreateWsspAssertionMustSupportRefEncryptedKeyName(),
CreateWsspRequireSignatureConformationAssertion(requireSignatureConfirmation)
));
return result;
}
示例13: CreateWsspWssAssertion
public virtual XmlElement CreateWsspWssAssertion(MetadataExporter exporter, SecurityBindingElement binding)
{
if (binding == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding");
}
if (binding.MessageSecurityVersion.SecurityVersion == SecurityVersion.WSSecurity10)
{
return CreateWsspWss10Assertion(exporter);
}
else if (binding.MessageSecurityVersion.SecurityVersion == SecurityVersion.WSSecurity11)
{
if (binding is SymmetricSecurityBindingElement)
{
return CreateWsspWss11Assertion(exporter, ((SymmetricSecurityBindingElement)binding).RequireSignatureConfirmation);
}
else if (binding is AsymmetricSecurityBindingElement)
{
return CreateWsspWss11Assertion(exporter, ((AsymmetricSecurityBindingElement)binding).RequireSignatureConfirmation);
}
else
{
return CreateWsspWss11Assertion(exporter, false);
}
}
else
{
return null;
}
}
示例14: CreateWsspAsymmetricBindingAssertion
public virtual XmlElement CreateWsspAsymmetricBindingAssertion(MetadataExporter exporter, PolicyConversionContext policyContext, AsymmetricSecurityBindingElement binding)
{
if (binding == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("binding");
}
XmlElement result = CreateWsspAssertion(AsymmetricBindingName);
result.AppendChild(
CreateWspPolicyWrapper(
exporter,
CreateWsspInitiatorTokenAssertion(exporter, binding.InitiatorTokenParameters),
CreateWsspRecipientTokenAssertion(exporter, binding.RecipientTokenParameters),
CreateWsspAlgorithmSuiteAssertion(exporter, binding.DefaultAlgorithmSuite),
CreateWsspLayoutAssertion(exporter, binding.SecurityHeaderLayout),
CreateWsspIncludeTimestampAssertion(binding.IncludeTimestamp),
CreateWsspEncryptBeforeSigningAssertion(binding.MessageProtectionOrder),
CreateWsspEncryptSignatureAssertion(policyContext, binding),
CreateWsspProtectTokensAssertion(binding),
CreateWsspAssertion(OnlySignEntireHeadersAndBodyName)
));
return result;
}
示例15: CreateTokenAssertion
public virtual XmlElement CreateTokenAssertion(MetadataExporter exporter, SecurityTokenParameters parameters, bool isOptional)
{
if (parameters == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parameters");
}
XmlElement result;
if (parameters is KerberosSecurityTokenParameters)
{
result = CreateWsspKerberosTokenAssertion(exporter, (KerberosSecurityTokenParameters)parameters);
}
else if (parameters is X509SecurityTokenParameters)
{
result = CreateWsspX509TokenAssertion(exporter, (X509SecurityTokenParameters)parameters);
}
else if (parameters is UserNameSecurityTokenParameters)
{
result = CreateWsspUsernameTokenAssertion(exporter, (UserNameSecurityTokenParameters)parameters);
}
else if (parameters is IssuedSecurityTokenParameters)
{
result = CreateWsspIssuedTokenAssertion(exporter, (IssuedSecurityTokenParameters)parameters);
}
else if (parameters is SspiSecurityTokenParameters)
{
result = CreateWsspSpnegoContextTokenAssertion(exporter, (SspiSecurityTokenParameters)parameters);
}
else if (parameters is SslSecurityTokenParameters)
{
result = CreateMsspSslContextTokenAssertion(exporter, (SslSecurityTokenParameters)parameters);
}
else if (parameters is SecureConversationSecurityTokenParameters)
{
result = CreateWsspSecureConversationTokenAssertion(exporter, (SecureConversationSecurityTokenParameters)parameters);
}
else if (parameters is RsaSecurityTokenParameters)
{
result = CreateWsspRsaTokenAssertion((RsaSecurityTokenParameters)parameters);
}
else
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("parameters"));
}
if (result != null && isOptional)
{
result.SetAttribute(OptionalName, exporter.PolicyVersion.Namespace, TrueName);
}
return result;
}