private static MessagePartSpecification ExtractMessageParts(string action, ScopedMessagePartSpecification scopedParts, bool isForSignature) { MessagePartSpecification parts = null; if (scopedParts.TryGetParts(action, out parts)) { return(parts); } else if (scopedParts.TryGetParts(MessageHeaders.WildcardAction, out parts)) { return(parts); } // send back a fault indication that the action is unknown SecurityVersion wss = MessageSecurityVersion.Default.SecurityVersion; FaultCode subCode = new FaultCode(wss.InvalidSecurityFaultCode.Value, wss.HeaderNamespace.Value); FaultCode senderCode = FaultCode.CreateSenderFaultCode(subCode); FaultReason reason = new FaultReason(SR.Format(SR.InvalidOrUnrecognizedAction, action), System.Globalization.CultureInfo.CurrentCulture); MessageFault fault = MessageFault.CreateFault(senderCode, reason); if (isForSignature) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR.NoSignaturePartsSpecified, action), null, fault)); } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new MessageSecurityException(SR.Format(SR.NoEncryptionPartsSpecified, action), null, fault)); } }
private static void AddActionParts(ScopedMessagePartSpecification to, ScopedMessagePartSpecification from) { foreach (string action in from.Actions) { if (from.TryGetParts(action, true, out MessagePartSpecification p)) { to.AddParts(p, action); } } }
static void AddActionParts(ScopedMessagePartSpecification to, ScopedMessagePartSpecification from) { foreach (var action in from.Actions) { MessagePartSpecification p; if (from.TryGetParts(action, true, out p)) { to.AddParts(p, action); } } }
private static MessagePartSpecification UnionMessagePartSpecifications(ScopedMessagePartSpecification actionParts) { var result = new MessagePartSpecification(false); foreach (string action in actionParts.Actions) { if (actionParts.TryGetParts(action, out MessagePartSpecification parts)) { if (parts.IsBodyIncluded) { result.IsBodyIncluded = true; } foreach (XmlQualifiedName headerType in parts.HeaderTypes) { if (!result.IsHeaderIncluded(headerType.Name, headerType.Namespace)) { result.HeaderTypes.Add(headerType); } } } } return(result); }