| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Xml; |
| | | 6 | | using CoreWCF.Security; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Channels |
| | | 9 | | { |
| | | 10 | | public sealed class AddressingVersion |
| | | 11 | | { |
| | | 12 | | private readonly string _toStringFormat; |
| | | 13 | | |
| | 39 | 14 | | private AddressingVersion(string ns, XmlDictionaryString dictionaryNs, string toStringFormat, |
| | 39 | 15 | | MessagePartSpecification signedMessageParts, string anonymous, XmlDictionaryString dictionaryAnonymous, stri |
| | | 16 | | { |
| | 39 | 17 | | Namespace = ns; |
| | 39 | 18 | | DictionaryNamespace = dictionaryNs; |
| | 39 | 19 | | _toStringFormat = toStringFormat; |
| | 39 | 20 | | SignedMessageParts = signedMessageParts; |
| | 39 | 21 | | Anonymous = anonymous; |
| | 39 | 22 | | DictionaryAnonymous = dictionaryAnonymous; |
| | | 23 | | |
| | 39 | 24 | | if (anonymous != null) |
| | | 25 | | { |
| | 26 | 26 | | AnonymousUri = new Uri(anonymous); |
| | | 27 | | } |
| | | 28 | | |
| | 39 | 29 | | if (none != null) |
| | | 30 | | { |
| | 13 | 31 | | NoneUri = new Uri(none); |
| | | 32 | | } |
| | | 33 | | |
| | 39 | 34 | | FaultAction = faultAction; |
| | 39 | 35 | | DefaultFaultAction = defaultFaultAction; |
| | 39 | 36 | | } |
| | | 37 | | |
| | 22318 | 38 | | public static AddressingVersion WSAddressing10 { get; } = new AddressingVersion(Addressing10Strings.Namespace, |
| | 13 | 39 | | XD.Addressing10Dictionary.Namespace, SR.Addressing10ToStringFormat, Addressing10SignedMessageParts, |
| | 13 | 40 | | Addressing10Strings.Anonymous, XD.Addressing10Dictionary.Anonymous, Addressing10Strings.NoneAddress, |
| | 13 | 41 | | Addressing10Strings.FaultAction, Addressing10Strings.DefaultFaultAction); |
| | | 42 | | |
| | | 43 | | private static MessagePartSpecification s_addressing10SignedMessageParts; |
| | | 44 | | |
| | 125856 | 45 | | public static AddressingVersion None { get; } = new AddressingVersion(AddressingNoneStrings.Namespace, XD.Addres |
| | 13 | 46 | | SR.AddressingNoneToStringFormat, new MessagePartSpecification(), null, null, null, null, null); |
| | | 47 | | |
| | 1942 | 48 | | public static AddressingVersion WSAddressingAugust2004 { get; } = new AddressingVersion(Addressing200408Strings. |
| | 13 | 49 | | XD.Addressing200408Dictionary.Namespace, SR.Addressing200408ToStringFormat, Addressing200408SignedMessagePar |
| | 13 | 50 | | Addressing200408Strings.Anonymous, XD.Addressing200408Dictionary.Anonymous, null, |
| | 13 | 51 | | Addressing200408Strings.FaultAction, Addressing200408Strings.DefaultFaultAction); |
| | | 52 | | |
| | | 53 | | private static MessagePartSpecification s_addressing200408SignedMessageParts; |
| | | 54 | | |
| | 47343 | 55 | | public string Namespace { get; } |
| | | 56 | | |
| | 23808 | 57 | | internal XmlDictionaryString DictionaryNamespace { get; } |
| | | 58 | | |
| | 1124 | 59 | | internal string Anonymous { get; } |
| | | 60 | | |
| | 93 | 61 | | internal XmlDictionaryString DictionaryAnonymous { get; } |
| | | 62 | | |
| | 2677 | 63 | | public Uri AnonymousUri { get; } |
| | | 64 | | |
| | 0 | 65 | | public Uri NoneUri { get; } |
| | | 66 | | |
| | 2 | 67 | | public string FaultAction { get; } // the action for addressing faults |
| | | 68 | | |
| | 2656 | 69 | | internal string DefaultFaultAction { get; } // a default string that can be used for non-addressing faults |
| | | 70 | | |
| | 18 | 71 | | internal MessagePartSpecification SignedMessageParts { get; } |
| | | 72 | | |
| | | 73 | | public override string ToString() |
| | | 74 | | { |
| | 43 | 75 | | return SR.Format(_toStringFormat, Namespace); |
| | | 76 | | } |
| | | 77 | | |
| | | 78 | | private static MessagePartSpecification Addressing10SignedMessageParts |
| | | 79 | | { |
| | | 80 | | get |
| | | 81 | | { |
| | 13 | 82 | | if (s_addressing10SignedMessageParts == null) |
| | | 83 | | { |
| | 13 | 84 | | MessagePartSpecification s = new MessagePartSpecification( |
| | 13 | 85 | | new XmlQualifiedName(AddressingStrings.To, Addressing10Strings.Namespace), |
| | 13 | 86 | | new XmlQualifiedName(AddressingStrings.From, Addressing10Strings.Namespace), |
| | 13 | 87 | | new XmlQualifiedName(AddressingStrings.FaultTo, Addressing10Strings.Namespace), |
| | 13 | 88 | | new XmlQualifiedName(AddressingStrings.ReplyTo, Addressing10Strings.Namespace), |
| | 13 | 89 | | new XmlQualifiedName(AddressingStrings.MessageId, Addressing10Strings.Namespace), |
| | 13 | 90 | | new XmlQualifiedName(AddressingStrings.RelatesTo, Addressing10Strings.Namespace), |
| | 13 | 91 | | new XmlQualifiedName(AddressingStrings.Action, Addressing10Strings.Namespace) |
| | 13 | 92 | | ); |
| | 13 | 93 | | s.MakeReadOnly(); |
| | 13 | 94 | | s_addressing10SignedMessageParts = s; |
| | | 95 | | } |
| | | 96 | | |
| | 13 | 97 | | return s_addressing10SignedMessageParts; |
| | | 98 | | } |
| | | 99 | | } |
| | | 100 | | |
| | | 101 | | private static MessagePartSpecification Addressing200408SignedMessageParts |
| | | 102 | | { |
| | | 103 | | get |
| | | 104 | | { |
| | 13 | 105 | | if (s_addressing200408SignedMessageParts == null) |
| | | 106 | | { |
| | 13 | 107 | | MessagePartSpecification s = new MessagePartSpecification( |
| | 13 | 108 | | new XmlQualifiedName(AddressingStrings.To, Addressing200408Strings.Namespace), |
| | 13 | 109 | | new XmlQualifiedName(AddressingStrings.From, Addressing200408Strings.Namespace), |
| | 13 | 110 | | new XmlQualifiedName(AddressingStrings.FaultTo, Addressing200408Strings.Namespace), |
| | 13 | 111 | | new XmlQualifiedName(AddressingStrings.ReplyTo, Addressing200408Strings.Namespace), |
| | 13 | 112 | | new XmlQualifiedName(AddressingStrings.MessageId, Addressing200408Strings.Namespace), |
| | 13 | 113 | | new XmlQualifiedName(AddressingStrings.RelatesTo, Addressing200408Strings.Namespace), |
| | 13 | 114 | | new XmlQualifiedName(AddressingStrings.Action, Addressing200408Strings.Namespace) |
| | 13 | 115 | | ); |
| | 13 | 116 | | s.MakeReadOnly(); |
| | 13 | 117 | | s_addressing200408SignedMessageParts = s; |
| | | 118 | | } |
| | | 119 | | |
| | 13 | 120 | | return s_addressing200408SignedMessageParts; |
| | | 121 | | } |
| | | 122 | | } |
| | | 123 | | } |
| | | 124 | | } |