| | | 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.Net; |
| | | 6 | | using System.Net.Security; |
| | | 7 | | using System.Net.WebSockets; |
| | | 8 | | using System.Security.Authentication; |
| | | 9 | | using System.Text; |
| | | 10 | | using CoreWCF.Channels; |
| | | 11 | | using CoreWCF.IdentityModel.Tokens; |
| | | 12 | | using CoreWCF.Security; |
| | | 13 | | |
| | | 14 | | namespace CoreWCF.Configuration |
| | | 15 | | { |
| | | 16 | | internal static class BinaryEncoderDefaults |
| | | 17 | | { |
| | 0 | 18 | | internal static EnvelopeVersion EnvelopeVersion { get { return EnvelopeVersion.Soap12; } } |
| | | 19 | | |
| | | 20 | | internal const int MaxSessionSize = 2048; |
| | | 21 | | } |
| | | 22 | | |
| | | 23 | | internal static class ConnectionOrientedTransportDefaults |
| | | 24 | | { |
| | | 25 | | internal const HostNameComparisonMode HostNameComparisonMode = CoreWCF.HostNameComparisonMode.StrongWildcard; |
| | | 26 | | internal const int ConnectionBufferSize = 8192; |
| | | 27 | | internal const ProtectionLevel ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign; |
| | | 28 | | internal const string ChannelInitializationTimeoutString = "00:00:30"; |
| | | 29 | | internal const int MaxPendingConnectionsConst = 0; |
| | | 30 | | internal const string MaxOutputDelayString = "00:00:00.2"; |
| | | 31 | | internal const int MaxPendingAcceptsConst = 0; |
| | | 32 | | internal const TransferMode TransferMode = CoreWCF.TransferMode.Buffered; |
| | | 33 | | internal const string IdleTimeoutString = "00:02:00"; |
| | | 34 | | internal const int MaxOutboundConnectionsPerEndpoint = 10; |
| | | 35 | | } |
| | | 36 | | |
| | | 37 | | internal static class HttpTransportDefaults |
| | | 38 | | { |
| | | 39 | | internal const bool AllowCookies = false; |
| | | 40 | | internal const AuthenticationSchemes AuthenticationScheme = AuthenticationSchemes.Anonymous; |
| | | 41 | | internal const bool BypassProxyOnLocal = false; |
| | | 42 | | internal const bool DecompressionEnabled = true; |
| | | 43 | | internal const HostNameComparisonMode HostNameComparisonMode = CoreWCF.HostNameComparisonMode.StrongWildcard; |
| | | 44 | | internal const bool KeepAliveEnabled = true; |
| | | 45 | | internal const Uri ProxyAddress = null; |
| | | 46 | | internal const AuthenticationSchemes ProxyAuthenticationScheme = AuthenticationSchemes.Anonymous; |
| | | 47 | | internal const string Realm = ""; |
| | | 48 | | internal const TransferMode TransferMode = CoreWCF.TransferMode.Buffered; |
| | | 49 | | internal const bool UnsafeConnectionNtlmAuthentication = false; |
| | | 50 | | internal const bool UseDefaultWebProxy = true; |
| | | 51 | | |
| | | 52 | | internal const string RequestInitializationTimeoutString = "00:00:00"; |
| | | 53 | | } |
| | | 54 | | |
| | | 55 | | internal static class MtomEncoderDefaults |
| | | 56 | | { |
| | | 57 | | internal const int MaxBufferSize = 65536; |
| | | 58 | | } |
| | | 59 | | |
| | | 60 | | internal static class OneWayDefaults |
| | | 61 | | { |
| | | 62 | | internal const string IdleTimeoutString = "00:02:00"; |
| | | 63 | | internal const int MaxOutboundChannelsPerEndpoint = 10; |
| | | 64 | | internal const string LeaseTimeoutString = "00:10:00"; |
| | | 65 | | internal const int MaxAcceptedChannels = 10; |
| | | 66 | | internal const bool PacketRoutable = false; |
| | | 67 | | } |
| | | 68 | | |
| | | 69 | | internal static class SecurityBindingDefaults |
| | | 70 | | { |
| | | 71 | | internal const SecurityKeyType DefaultKeyType = SecurityKeyType.SymmetricKey; |
| | | 72 | | internal const string DefaultAlgorithmSuiteString = "Default"; |
| | | 73 | | internal const bool DefaultRequireDerivedKeys = true; |
| | | 74 | | internal const bool DefaultAllowSerializedSigningTokenOnReply = false; |
| | | 75 | | internal const bool DefaultEnableUnsecuredResponse = false; |
| | | 76 | | internal const bool DefaultIncludeTimestamp = true; |
| | | 77 | | internal const bool DefaultAllowInsecureTransport = false; |
| | | 78 | | internal const bool DefaultRequireSignatureConfirmation = false; |
| | | 79 | | internal const bool DefaultRequireCancellation = true; |
| | | 80 | | internal const bool DefaultCanRenewSession = true; |
| | | 81 | | internal const bool DefaultDetectReplays = true; |
| | | 82 | | internal const int DefaultMaxCachedNonces = 900000; |
| | | 83 | | internal const string DefaultTimestampValidityDurationString = "00:05:00"; |
| | | 84 | | internal const string DefaultMaxClockSkewString = "00:05:00"; |
| | | 85 | | internal const string DefaultReplayWindowString = "00:05:00"; |
| | | 86 | | internal const string DefaultClientMaxTokenCachingTimeString = "10675199.02:48:05.4775807"; |
| | | 87 | | internal const bool DefaultClientCacheTokens = true; |
| | | 88 | | internal const int DefaultServiceTokenValidityThresholdPercentage = 60; |
| | | 89 | | internal const string DefaultClientKeyRenewalIntervalString = "10:00:00"; |
| | | 90 | | internal const string DefaultClientKeyRolloverIntervalString = "00:05:00"; |
| | | 91 | | internal const bool DefaultTolerateTransportFailures = true; |
| | | 92 | | internal const string DefaultServerMaxNegotiationLifetimeString = "00:01:00"; |
| | | 93 | | internal const string DefaultServerIssuedTokenLifetimeString = "10:00:00"; |
| | | 94 | | internal const string DefaultServerIssuedTransitionTokenLifetimeString = "00:15:00"; |
| | | 95 | | internal const int DefaultServerMaxActiveNegotiations = 128; |
| | | 96 | | internal const string DefaultKeyRenewalIntervalString = "15:00:00"; |
| | | 97 | | internal const string DefaultKeyRolloverIntervalString = "00:05:00"; |
| | | 98 | | internal const string DefaultInactivityTimeoutString = "00:02:00"; |
| | | 99 | | internal const int DefaultMaximumPendingSessions = 128; |
| | | 100 | | internal const int DefaultServerMaxCachedTokens = 1000; |
| | | 101 | | internal const SecurityHeaderLayout DefaultSecurityHeaderLayout = SecurityHeaderLayout.Strict; |
| | | 102 | | internal const SecurityKeyEntropyMode DefaultKeyEntropyMode = SecurityKeyEntropyMode.CombinedEntropy; |
| | | 103 | | internal const MessageProtectionOrder DefaultMessageProtectionOrder = MessageProtectionOrder.SignBeforeEncryptAn |
| | | 104 | | internal const AuthenticationMode DefaultAuthenticationMode = AuthenticationMode.SspiNegotiatedOverTransport; |
| | | 105 | | } |
| | | 106 | | |
| | | 107 | | internal static class TcpTransportDefaults |
| | | 108 | | { |
| | | 109 | | internal const int ListenBacklogConst = 0; |
| | | 110 | | internal const string ConnectionLeaseTimeoutString = "00:05:00"; |
| | | 111 | | internal const bool PortSharingEnabled = false; |
| | | 112 | | internal const bool TeredoEnabled = false; |
| | | 113 | | } |
| | | 114 | | |
| | | 115 | | internal static class TextEncoderDefaults |
| | | 116 | | { |
| | | 117 | | internal static readonly Encoding s_encoding = Encoding.GetEncoding(TextEncoderDefaults.EncodingString, new Enco |
| | | 118 | | internal const string EncodingString = "utf-8"; |
| | | 119 | | internal static readonly Encoding[] s_supportedEncodings = new Encoding[] { Encoding.UTF8, Encoding.Unicode, Enc |
| | | 120 | | internal const string MessageVersionString = ConfigurationStrings.Soap12WSAddressing10; |
| | | 121 | | } |
| | | 122 | | |
| | | 123 | | internal static class TransportDefaults |
| | | 124 | | { |
| | | 125 | | internal const long MaxReceivedMessageSize = 65536; |
| | | 126 | | internal const int MaxBufferSize = (int)MaxReceivedMessageSize; |
| | | 127 | | internal const bool RequireClientCertificate = false; |
| | | 128 | | internal const long MaxBufferPoolSize = 512 * 1024; |
| | | 129 | | internal const SslProtocols OldDefaultSslProtocols = SslProtocols.Tls | |
| | | 130 | | SslProtocols.Tls11 | |
| | | 131 | | SslProtocols.Tls12; |
| | | 132 | | } |
| | | 133 | | |
| | | 134 | | internal static class WebSocketDefaults |
| | | 135 | | { |
| | | 136 | | internal const WebSocketTransportUsage TransportUsage = WebSocketTransportUsage.Never; |
| | | 137 | | internal const bool CreateNotificationOnConnection = false; |
| | | 138 | | internal const string DefaultKeepAliveIntervalString = "00:00:00"; |
| | | 139 | | |
| | | 140 | | internal const int BufferSize = 16 * 1024; |
| | | 141 | | internal const int MinReceiveBufferSize = 256; |
| | | 142 | | internal const int MinSendBufferSize = 16; |
| | | 143 | | internal const bool DisablePayloadMasking = false; |
| | | 144 | | internal const WebSocketMessageType DefaultWebSocketMessageType = WebSocketMessageType.Binary; |
| | | 145 | | internal const string SubProtocol = null; |
| | | 146 | | |
| | | 147 | | internal const int DefaultMaxPendingConnections = 0; |
| | | 148 | | // We set this number larger than that in TCP transport because in WebSocket cases, the connection is already au |
| | | 149 | | // after we create the half-open channel. The default value is set as the default one as MaxConcurrentSessions t |
| | | 150 | | // well in burst scenarios. |
| | | 151 | | internal const int DefaultMaxConcurrentSessions = 100; |
| | | 152 | | internal static readonly int s_maxPendingConnectionsCpuCount = DefaultMaxConcurrentSessions * Environment.Proces |
| | | 153 | | |
| | | 154 | | internal const string WebSocketConnectionHeaderValue = "Upgrade"; |
| | | 155 | | internal const string WebSocketUpgradeHeaderValue = "websocket"; |
| | | 156 | | } |
| | | 157 | | |
| | | 158 | | |
| | | 159 | | } |