public override bool TryImportWsspSupportingTokensAssertion(MetadataImporter importer, PolicyConversionContext policyContext, ICollection <XmlElement> assertions, Collection <SecurityTokenParameters> signed, Collection <SecurityTokenParameters> signedEncrypted, Collection <SecurityTokenParameters> endorsing, Collection <SecurityTokenParameters> signedEndorsing, Collection <SecurityTokenParameters> optionalSigned, Collection <SecurityTokenParameters> optionalSignedEncrypted, Collection <SecurityTokenParameters> optionalEndorsing, Collection <SecurityTokenParameters> optionalSignedEndorsing) { XmlElement assertion; if (!TryImportWsspSignedSupportingTokensAssertion( importer, policyContext, assertions, signed, optionalSigned, out assertion) && assertion != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.UnsupportedSecurityPolicyAssertion, assertion.OuterXml))); } if (!TryImportWsspSignedEncryptedSupportingTokensAssertion( importer, policyContext, assertions, signedEncrypted, optionalSignedEncrypted, out assertion) && assertion != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.UnsupportedSecurityPolicyAssertion, assertion.OuterXml))); } if (!TryImportWsspEndorsingSupportingTokensAssertion( importer, policyContext, assertions, endorsing, optionalEndorsing, out assertion) && assertion != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.UnsupportedSecurityPolicyAssertion, assertion.OuterXml))); } if (!TryImportWsspSignedEndorsingSupportingTokensAssertion( importer, policyContext, assertions, signedEndorsing, optionalSignedEndorsing, out assertion) && assertion != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.UnsupportedSecurityPolicyAssertion, assertion.OuterXml))); } return(true); }
private static void ProcessReliableSession11Assertion(MetadataImporter importer, XmlElement element, ReliableSessionBindingElement settings) { // Version settings.ReliableMessagingVersion = ReliableMessagingVersion.WSReliableMessaging11; IEnumerator assertionChildren = element.ChildNodes.GetEnumerator(); XmlNode currentNode = SkipToNode(assertionChildren); // Policy ProcessWsrm11Policy(importer, currentNode, settings); currentNode = SkipToNode(assertionChildren); // Looking for: // InactivityTimeout, AcknowledgementInterval // InactivityTimeout // AcknowledgementInterval // or nothing at all. State state = State.InactivityTimeout; while (currentNode != null) { if (state == State.InactivityTimeout) { // InactivityTimeout assertion if (Is11Assertion(currentNode, ReliableSessionPolicyStrings.InactivityTimeout)) { SetInactivityTimeout(settings, ReadMillisecondsAttribute(currentNode, true), currentNode.LocalName); state = State.AcknowledgementInterval; currentNode = SkipToNode(assertionChildren); continue; } } // AcknowledgementInterval assertion if (Is11Assertion(currentNode, ReliableSessionPolicyStrings.AcknowledgementInterval)) { SetAcknowledgementInterval(settings, ReadMillisecondsAttribute(currentNode, true), currentNode.LocalName); // ignore the rest break; } if (state == State.AcknowledgementInterval) { // ignore the rest break; } currentNode = SkipToNode(assertionChildren); } // Schema allows arbitrary elements from now on, ignore everything else }
internal override void OnImportPolicy(MetadataImporter importer, PolicyConversionContext policyContext) { base.OnImportPolicy(importer, policyContext); WSSecurityPolicy sp = null; if (WSSecurityPolicy.TryGetSecurityPolicyDriver(policyContext.GetBindingAssertions(), out sp)) { sp.TryImportWsspHttpsTokenAssertion(importer, policyContext.GetBindingAssertions(), this); } }
bool ImportHttpAuthScheme(MetadataImporter importer, HttpTransportBindingElement bindingElement, PolicyConversionContext context) { var assertions = context.GetBindingAssertions(); var authSchemes = AuthenticationSchemes.None; var httpsTransport = bindingElement as HttpsTransportBindingElement; bool certificate = httpsTransport != null ? httpsTransport.RequireClientCertificate : false; var authElements = PolicyImportHelper.FindAssertionByNS( assertions, PolicyImportHelper.HttpAuthNS); foreach (XmlElement authElement in authElements) { assertions.Remove(authElement); if (certificate) { importer.AddWarning( "Invalid authentication assertion while " + "using client certificate: {0}", authElement.OuterXml); return(false); } switch (authElement.LocalName) { case "BasicAuthentication": authSchemes |= AuthenticationSchemes.Basic; break; case "NtlmAuthentication": authSchemes |= AuthenticationSchemes.Ntlm; break; case "DigestAuthentication": authSchemes |= AuthenticationSchemes.Digest; break; case "NegotiateAuthentication": authSchemes |= AuthenticationSchemes.Negotiate; break; default: importer.AddWarning( "Invalid policy assertion: {0}", authElement.OuterXml); return(false); } } bindingElement.AuthenticationScheme = authSchemes; return(true); }
public MethodReference ImportReference (MethodReference method, IGenericParameterProvider context) { Mixin.CheckMethod (method); if (method.Module == this) return method; CheckContext (context, this); return MetadataImporter.ImportReference (method, context); }
public FieldReference ImportReference (FieldReference field, IGenericParameterProvider context) { Mixin.CheckField (field); if (field.Module == this) return field; CheckContext (context, this); return MetadataImporter.ImportReference (field, context); }
public TypeReference ImportReference (TypeReference type, IGenericParameterProvider context) { Mixin.CheckType (type); if (type.Module == this) return type; CheckContext (context, this); return MetadataImporter.ImportReference (type, context); }
private static void AddStateForXmlSerializerImport(MetadataImporter importer, CodeCompileUnit codeCompileUnit, CodeDomProvider codeDomProvider) { XmlSerializerImportOptions importOptions = new XmlSerializerImportOptions(codeCompileUnit); importOptions.CodeProvider = codeDomProvider; importOptions.WebReferenceOptions = new WebReferenceOptions(); importOptions.WebReferenceOptions.CodeGenerationOptions = CodeGenerationOptions.GenerateProperties | CodeGenerationOptions.GenerateOrder; importOptions.WebReferenceOptions.SchemaImporterExtensions.Add(typeof(TypedDataSetSchemaImporterExtension).AssemblyQualifiedName); importOptions.WebReferenceOptions.SchemaImporterExtensions.Add(typeof(DataSetSchemaImporterExtension).AssemblyQualifiedName); importer.State.Add(typeof(XmlSerializerImportOptions), importOptions); }
void System.ServiceModel.Description.IPolicyImportExtension.ImportPolicy(MetadataImporter importer, PolicyConversionContext context) { if (importer == null || context == null) { throw Microsoft.ServiceBus.Messaging.FxTrace.Exception.ArgumentNull((importer == null ? "importer" : "context")); } if (context.GetBindingAssertions().Remove("netMessaging", "http://sample.schemas.microsoft.com/policy/netMessaging") != null) { NetMessagingTransportBindingElement netMessagingTransportBindingElement = new NetMessagingTransportBindingElement(); context.BindingElements.Add(netMessagingTransportBindingElement); } }
void ITransportPolicyImport.ImportPolicy(MetadataImporter importer, PolicyConversionContext context) { if (importer == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("importer"); } if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } this.peerSecurity.OnImportPolicy(importer, context); }
void IPolicyImportExtension.ImportPolicy(MetadataImporter importer, PolicyConversionContext context) { if (importer == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("importer"); } if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } this.ImportPolicyInternal(context); }
void IPolicyImportExtension.ImportPolicy(MetadataImporter importer, PolicyConversionContext policyContext) { if (policyContext == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("policyContext"); } if ((PolicyConversionContext.FindAssertion(policyContext.GetBindingAssertions(), "RequireFederatedIdentityProvisioning", "http://schemas.xmlsoap.org/ws/2005/05/identity", true) != null) && (policyContext.BindingElements.Find <UseManagedPresentationBindingElement>() == null)) { UseManagedPresentationBindingElement item = new UseManagedPresentationBindingElement(); policyContext.BindingElements.Add(item); } }
void IPolicyImportExtension.ImportPolicy(MetadataImporter importer, PolicyConversionContext context) { if (importer == null) { throw new ArgumentNullException("importer"); } if (context == null) { throw new ArgumentNullException("context"); } ICollection <XmlElement> bindingAssertions = context.GetBindingAssertions(); List <XmlElement> processedAssertions = new List <XmlElement>(); UdpTransportBindingElement udpBindingElement = null; bool multicast = false; foreach (XmlElement assertion in bindingAssertions) { if (assertion.NamespaceURI != UdpPolicyStrings.UdpNamespace) { continue; } switch (assertion.LocalName) { case UdpPolicyStrings.TransportAssertion: udpBindingElement = new UdpTransportBindingElement(); break; case UdpPolicyStrings.MulticastAssertion: multicast = true; break; default: continue; } processedAssertions.Add(assertion); } if (udpBindingElement != null) { udpBindingElement.Multicast = multicast; context.BindingElements.Add(udpBindingElement); } for (int i = 0; i < processedAssertions.Count; i++) { bindingAssertions.Remove(processedAssertions[i]); } }
public override bool TryImportWsspRsaTokenAssertion(MetadataImporter importer, XmlElement assertion, out SecurityTokenParameters parameters) { SecurityTokenInclusionMode mode; Collection <Collection <XmlElement> > collection; parameters = null; if ((this.IsWsspAssertion(assertion, "KeyValueToken") && this.TryGetIncludeTokenValue(assertion, out mode)) && !this.TryGetNestedPolicyAlternatives(importer, assertion, out collection)) { parameters = new RsaSecurityTokenParameters(); parameters.InclusionMode = mode; } return(parameters != null); }
public FieldReference ImportReference(FieldReference field, IGenericParameterProvider context) { Root.Code.Libs.Mono.Cecil.Mixin.CheckField(field); if (field.Module == this) { return(field); } CheckContext(context, this); return(MetadataImporter.ImportReference(field, context)); }
public TypeReference ImportReference(TypeReference type, IGenericParameterProvider context) { Root.Code.Libs.Mono.Cecil.Mixin.CheckType(type); if (type.Module == this) { return(type); } CheckContext(context, this); return(MetadataImporter.ImportReference(type, context)); }
public MethodReference ImportReference(MethodReference method, IGenericParameterProvider context) { Root.Code.Libs.Mono.Cecil.Mixin.CheckMethod(method); if (method.Module == this) { return(method); } CheckContext(context, this); return(MetadataImporter.ImportReference(method, context)); }
void IPolicyImportExtension.ImportPolicy(MetadataImporter importer, PolicyConversionContext policyContext) { if (importer == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("importer"); } if (policyContext == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("policyContext"); } WSSecurityPolicy securityPolicy; if (WSSecurityPolicy.TryGetSecurityPolicyDriver(policyContext.GetBindingAssertions(), out securityPolicy)) { if ((importer.State != null) && (!importer.State.ContainsKey(MaxPolicyRedirectionsKey))) { importer.State.Add(MaxPolicyRedirectionsKey, this.MaxPolicyRedirections); } SecurityBindingElement sbe = null; bool success = this.TryImportSymmetricSecurityBindingElement(importer, policyContext, out sbe); if (!success) { success = this.TryImportAsymmetricSecurityBindingElement(importer, policyContext, out sbe); } if (!success) { success = this.TryImportTransportSecurityBindingElement(importer, policyContext, out sbe, false); } else { // We already have found and imported the message security binding element above. Hence this could be the dual mode security. // Now let us see if there is HttpsTransportBinding assertion also below it .This is to avoid the // warning messages while importing wsdl representing the message security over Https transport security scenario. See Bug:136416. SecurityBindingElement tbe = null; this.TryImportTransportSecurityBindingElement(importer, policyContext, out tbe, true); } if (sbe != null) { SecurityElement config = new SecurityElement(); config.InitializeFrom(sbe, false); if (config.HasImportFailed) { #pragma warning suppress 56506 importer.Errors.Add(new MetadataConversionError(SR.GetString(SR.SecurityBindingElementCannotBeExpressedInConfig), true)); } } } }
public override bool TryImportWsspHttpsTokenAssertion(MetadataImporter importer, ICollection <XmlElement> assertions, HttpsTransportBindingElement httpsBinding) { if (assertions == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("assertions"); } bool result = true; XmlElement assertion; if (TryImportWsspAssertion(assertions, HttpsTokenName, out assertion)) { XmlElement policyElement = null; foreach (XmlNode node in assertion.ChildNodes) { if (node is XmlElement && node.LocalName == WSSecurityPolicy.PolicyName && (node.NamespaceURI == WSSecurityPolicy.WspNamespace || node.NamespaceURI == WSSecurityPolicy.Wsp15Namespace)) { policyElement = (XmlElement)node; break; } } if (policyElement != null) { foreach (XmlNode node in policyElement.ChildNodes) { if (node is XmlElement && node.NamespaceURI == this.WsspNamespaceUri) { if (node.LocalName == WSSecurityPolicy.RequireClientCertificateName) { httpsBinding.RequireClientCertificate = true; } else if (node.LocalName == WSSecurityPolicy.HttpBasicAuthenticationName) { httpsBinding.AuthenticationScheme = AuthenticationSchemes.Basic; } else if (node.LocalName == WSSecurityPolicy.HttpDigestAuthenticationName) { httpsBinding.AuthenticationScheme = AuthenticationSchemes.Digest; } } } } } else { result = false; } return(result); }
public void ConstructorsAreReportedAsJsonConstructors() { var compilation = new SimpleCompilation(new CSharpProjectContent()); var er = new MockErrorReporter(true); var md = new MetadataImporter(er, compilation, new CompilerOptions()); Assert.That(er.AllMessages, Is.Empty, "Prepare should not generate errors"); var t = CreateType(compilation); var c = md.GetConstructorSemantics(DefaultResolvedMethod.GetDummyConstructor(compilation, t)); Assert.That(c.Type, Is.EqualTo(ConstructorScriptSemantics.ImplType.Json)); }
public void ImportPolicy(MetadataImporter importer, PolicyConversionContext context) { XmlQualifiedName wsdlBindingQName; string transportUri = WsdlImporter.SoapInPolicyWorkaroundHelper.FindAdHocPolicy(context, this.udpTransportUriKey, out wsdlBindingQName); if (transportUri != null && transportUri.Equals(UdpConstants.WsdlSoapUdpTransportUri, StringComparison.Ordinal) && !context.BindingElements.Contains(typeof(TransportBindingElement))) { UdpTransportBindingElement transport = new UdpTransportBindingElement(); ((ITransportPolicyImport)transport).ImportPolicy(importer, context); StateHelper.RegisterTransportBindingElement(importer, wsdlBindingQName); context.BindingElements.Add(transport); } }
void ITransportPolicyImport.ImportPolicy(MetadataImporter importer, PolicyConversionContext policyContext) { ICollection <XmlElement> bindingAssertions = policyContext.GetBindingAssertions(); List <XmlElement> list = new List <XmlElement>(); bool flag = false; foreach (XmlElement element in bindingAssertions) { string str; if ((element.NamespaceURI != "http://schemas.microsoft.com/ws/06/2004/policy/http") || ((str = element.LocalName) == null)) { continue; } if (!(str == "BasicAuthentication")) { if (str == "DigestAuthentication") { goto Label_009A; } if (str == "NegotiateAuthentication") { goto Label_00A3; } if (str == "NtlmAuthentication") { goto Label_00AC; } continue; } this.AuthenticationScheme = AuthenticationSchemes.Basic; goto Label_00B3; Label_009A: this.AuthenticationScheme = AuthenticationSchemes.Digest; goto Label_00B3; Label_00A3: this.AuthenticationScheme = AuthenticationSchemes.Negotiate; goto Label_00B3; Label_00AC: this.AuthenticationScheme = AuthenticationSchemes.Ntlm; Label_00B3: if (flag) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.ServiceModel.SR.GetString("HttpTransportCannotHaveMultipleAuthenticationSchemes", new object[] { policyContext.Contract.Namespace, policyContext.Contract.Name }))); } flag = true; list.Add(element); } list.ForEach(element => bindingAssertions.Remove(element)); this.OnImportPolicy(importer, policyContext); }
bool ImportHttpTransport(MetadataImporter importer, PolicyConversionContext context, XmlElement transportPolicy, out HttpTransportBindingElement bindingElement) { XmlElement transportToken; if (!GetTransportToken(importer, transportPolicy, out transportToken)) { bindingElement = null; return(false); } if (transportToken == null) { bindingElement = new HttpTransportBindingElement(); return(true); } bool error; var tokenElementList = PolicyImportHelper.GetPolicyElements(transportToken, out error); if (error || (tokenElementList.Count != 1)) { importer.AddWarning("Invalid policy assertion: {0}", transportToken.OuterXml); bindingElement = null; return(false); } var tokenElement = tokenElementList [0]; if (!PolicyImportHelper.SecurityPolicyNS.Equals(tokenElement.NamespaceURI) || !tokenElement.LocalName.Equals("HttpsToken")) { importer.AddWarning("Invalid policy assertion: {0}", tokenElement.OuterXml); bindingElement = null; return(false); } var httpsTransport = new HttpsTransportBindingElement(); bindingElement = httpsTransport; var certAttr = tokenElement.GetAttribute("RequireClientCertificate"); if (!String.IsNullOrEmpty(certAttr)) { httpsTransport.RequireClientCertificate = Boolean.Parse(certAttr); } return(true); }
public override bool TryImportMsspSslContextTokenAssertion(MetadataImporter importer, XmlElement assertion, out SecurityTokenParameters parameters) { parameters = null; SecurityTokenInclusionMode inclusionMode; Collection <Collection <XmlElement> > alternatives; if (IsMsspAssertion(assertion, SslContextTokenName) && TryGetIncludeTokenValue(assertion, out inclusionMode)) { if (TryGetNestedPolicyAlternatives(importer, assertion, out alternatives)) { foreach (Collection <XmlElement> alternative in alternatives) { SslSecurityTokenParameters ssl = new SslSecurityTokenParameters(); parameters = ssl; bool requireCancellation; bool canRenewSession; if (TryImportWsspRequireDerivedKeysAssertion(alternative, ssl) && TryImportWsspMustNotSendCancelAssertion(alternative, out requireCancellation) && TryImportWsspMustNotSendAmendAssertion(alternative) // We do not support Renew for spnego and sslnego. Read the // assertion if present and ignore it. && TryImportWsspMustNotSendRenewAssertion(alternative, out canRenewSession) && TryImportMsspRequireClientCertificateAssertion(alternative, ssl) && alternative.Count == 0) { // Client always set this to true to match the standardbinding. // This setting on client has no effect for spnego and sslnego. ssl.RequireCancellation = true; ssl.InclusionMode = inclusionMode; break; } else { parameters = null; } } } else { parameters = new SslSecurityTokenParameters(); parameters.RequireDerivedKeys = false; parameters.InclusionMode = inclusionMode; } } return(parameters != null); }
public void TransparentIdentiferIsValidJavascriptIdentifierStartingWithDollar() { var compilation = new SimpleCompilation(new CSharpProjectContent()); var er = new MockErrorReporter(true); var md = new MetadataImporter(er, compilation, new CompilerOptions()); Assert.That(er.AllMessages, Is.Empty, "Prepare should not generate errors"); var t = CreateType(compilation, new[] { "<>Identifier" }); var c = md.GetPropertySemantics(t.GetProperties().Single()); Assert.That(c.Type, Is.EqualTo(PropertyScriptSemantics.ImplType.Field)); Assert.That(c.FieldName, Is.EqualTo("$Identifier")); }
void IPolicyImportExtension.ImportPolicy(MetadataImporter importer, PolicyConversionContext context) { if (importer == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("importer"); } if (context == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context"); } if ((PolicyConversionContext.FindAssertion(context.GetBindingAssertions(), "CompositeDuplex", "http://schemas.microsoft.com/net/2006/06/duplex", true) != null) || (WsdlImporter.WSAddressingHelper.DetermineSupportedAddressingMode(importer, context) == SupportedAddressingMode.NonAnonymous)) { context.BindingElements.Add(new CompositeDuplexBindingElement()); } }
private void ImportOperationScopeSupportingTokensPolicy(MetadataImporter importer, PolicyConversionContext policyContext, SecurityBindingElement binding) { foreach (OperationDescription operation in policyContext.Contract.Operations) { string requestAction = null; foreach (MessageDescription message in operation.Messages) { if (message.Direction == MessageDirection.Input) { requestAction = message.Action; break; } } SupportingTokenParameters requirements = new SupportingTokenParameters(); SupportingTokenParameters optionalRequirements = new SupportingTokenParameters(); ICollection <XmlElement> operationBindingAssertions = policyContext.GetOperationBindingAssertions(operation); this.ImportSupportingTokenAssertions(importer, policyContext, operationBindingAssertions, requirements, optionalRequirements); if (requirements.Endorsing.Count > 0 || requirements.Signed.Count > 0 || requirements.SignedEncrypted.Count > 0 || requirements.SignedEndorsing.Count > 0) { if (requestAction != null) { binding.OperationSupportingTokenParameters[requestAction] = requirements; } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SRServiceModel.CannotImportSupportingTokensForOperationWithoutRequestAction)); } } if (optionalRequirements.Endorsing.Count > 0 || optionalRequirements.Signed.Count > 0 || optionalRequirements.SignedEncrypted.Count > 0 || optionalRequirements.SignedEndorsing.Count > 0) { if (requestAction != null) { binding.OptionalOperationSupportingTokenParameters[requestAction] = optionalRequirements; } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.CannotImportSupportingTokensForOperationWithoutRequestAction))); } } } }
internal static bool FindPolicyElement(MetadataImporter importer, XmlElement root, QName name, bool required, bool removeWhenFound, out XmlElement element) { if (!FindPolicyElement(root, name, removeWhenFound, out element)) { importer.AddWarning("Invalid policy element: {0}", root.OuterXml); return(false); } if (required && (element == null)) { importer.AddWarning("Did not find policy element `{0}'.", name); return(false); } return(true); }
void System.ServiceModel.Description.IPolicyImportExtension.ImportPolicy(MetadataImporter importer, PolicyConversionContext context) { if (importer == null) { throw new ArgumentNullException("importer"); } if (context == null) { throw new ArgumentNullException("context"); } ICollection <XmlElement> bindingAssertions = context.GetBindingAssertions(); List <XmlElement> xmlElements = new List <XmlElement>(); RelayedOnewayTransportBindingElement relayedOnewayTransportBindingElement = null; foreach (XmlElement bindingAssertion in bindingAssertions) { if (!(bindingAssertion.NamespaceURI == "http://schemas.microsoft.com/netservices/2009/05/servicebus/connect") || !(bindingAssertion.LocalName == "RelayedOneway")) { continue; } bool flag = false; bool flag1 = false; foreach (XmlElement childNode in bindingAssertion.ChildNodes) { if (!(childNode.NamespaceURI == "http://schemas.microsoft.com/netservices/2009/05/servicebus/connect") || !(childNode.LocalName == "Multicast")) { continue; } flag = true; if (flag1) { throw new NotSupportedException(SRClient.MultipleConnectionModeAssertions); } flag1 = true; } relayedOnewayTransportBindingElement = new RelayedOnewayTransportBindingElement(RelayClientAuthenticationType.RelayAccessToken, (flag ? RelayedOnewayConnectionMode.Multicast : RelayedOnewayConnectionMode.Unicast)); xmlElements.Add(bindingAssertion); } if (relayedOnewayTransportBindingElement != null) { context.BindingElements.Add(relayedOnewayTransportBindingElement); } for (int i = 0; i < xmlElements.Count; i++) { bindingAssertions.Remove(xmlElements[i]); } }
private bool TryImportWsspSignedEncryptedSupportingTokensAssertion(MetadataImporter importer, PolicyConversionContext policyContext, ICollection <XmlElement> assertions, Collection <SecurityTokenParameters> signedEncrypted, Collection <SecurityTokenParameters> optionalSignedEncrypted, out XmlElement assertion) { if (signedEncrypted == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("signedEncrypted"); } if (optionalSignedEncrypted == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("optionalSignedEncrypted"); } bool result = true; Collection <Collection <XmlElement> > alternatives; if (TryImportWsspAssertion(assertions, SignedEncryptedSupportingTokensName, out assertion) && TryGetNestedPolicyAlternatives(importer, assertion, out alternatives)) { foreach (Collection <XmlElement> alternative in alternatives) { SecurityTokenParameters parameters; bool isOptional; while (alternative.Count > 0 && TryImportTokenAssertion(importer, policyContext, alternative, out parameters, out isOptional)) { if (isOptional) { optionalSignedEncrypted.Add(parameters); } else { signedEncrypted.Add(parameters); } } if (alternative.Count == 0) { result = true; break; } else { result = false; } } } return(result); }