1 //------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //------------------------------------------------------------
5 namespace System.IdentityModel
8 using System.Runtime.CompilerServices;
10 // When adding a quirk, name it such that false is new behavior and true is old behavior.
11 // You are opting IN to old behavior. The new behavior is default.
12 // For example, we want to enable the functionality to explicitly add a connection close header
13 // in 4.6 and above. So we set DisableExplicitConnectionCloseHeader to true if running 4.5.2 or less.
14 internal static class LocalAppContextSwitches
16 private const string EnableCachedEmptyDefaultAuthorizationContextString = "Switch.System.IdentityModel.EnableCachedEmptyDefaultAuthorizationContext";
17 private const string DisableMultipleDNSEntriesInSANCertificateString = "Switch.System.IdentityModel.DisableMultipleDNSEntriesInSANCertificate";
19 private static int enableCachedEmptyDefaultAuthorizationContext;
20 private static int disableMultipleDNSEntriesInSANCertificate;
22 public static bool EnableCachedEmptyDefaultAuthorizationContext
24 [MethodImpl(MethodImplOptions.AggressiveInlining)]
27 return LocalAppContext.GetCachedSwitchValue(EnableCachedEmptyDefaultAuthorizationContextString, ref enableCachedEmptyDefaultAuthorizationContext);
31 public static bool DisableMultipleDNSEntriesInSANCertificate
33 [MethodImpl(MethodImplOptions.AggressiveInlining)]
36 return LocalAppContext.GetCachedSwitchValue(DisableMultipleDNSEntriesInSANCertificateString, ref disableMultipleDNSEntriesInSANCertificate);
40 public static void SetDefaultsLessOrEqual_452()
42 // Define the switches that should be true for 4.5.2 or less, false for 4.6+.
43 LocalAppContext.DefineSwitchDefault(EnableCachedEmptyDefaultAuthorizationContextString, true);
46 public static void SetDefaultsLessOrEqual_46()
48 // Define the switches that should be true for 4.6 or less, false for 4.6.1+.
49 LocalAppContext.DefineSwitchDefault(DisableMultipleDNSEntriesInSANCertificateString, true);