Skip to content

Commit

Permalink
Revert configuration manager to 8.3.1 (#3132)
Browse files Browse the repository at this point in the history
  • Loading branch information
keegan-caruso authored Feb 14, 2025
1 parent 6074003 commit 414bf24
Show file tree
Hide file tree
Showing 23 changed files with 264 additions and 994 deletions.
7 changes: 6 additions & 1 deletion build/commonTest.props
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
<!-- Suprpess the "Microsoft.Bcl.Memory 9.0.0 doesn't support net6.0 and has not been tested with it" warning -->
<!-- Suprpess the "Microsoft.Bcl.Memory/Microsoft.Extensions.TimeProvider.Testing 9.0.0 doesn't support net6.0 and has not been tested with it" warning -->
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'net472'">
<!-- Suprpess the "Microsoft.Extensions.TimeProvider.Testing 9.0.0 doesn't support net462 and has not been tested with it" warning -->
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>

Expand Down
2 changes: 0 additions & 2 deletions build/dependenciesTest.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))">
<XunitRunnerVisualStudioVersion>3.0.0-pre.49</XunitRunnerVisualStudioVersion>
</PropertyGroup>

<!-- MicrosoftExtensionsTimeProviderTesting 8.x has a 6.0.0 target, 9.x does not. -->
<PropertyGroup Condition="'$(TargetFramework)' != 'net6.0'">
<MicrosoftExtensionsTimeProviderTestingVersion>9.0.0</MicrosoftExtensionsTimeProviderTestingVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
<MicrosoftExtensionsTimeProviderTestingVersion>8.10.0</MicrosoftExtensionsTimeProviderTestingVersion>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ internal JsonClaimSet CreateHeaderClaimSet(ReadOnlySpan<byte> byteSpan)
break;
else if (!reader.Read())
break;
};
}

return new JsonClaimSet(claims);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal JsonClaimSet CreatePayloadClaimSet(ReadOnlySpan<byte> byteSpan)
break;
else if (!reader.Read())
break;
};
}

return new JsonClaimSet(claims);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public virtual void SetParameters(NameValueCollection nameValueCollection)
foreach (string key in nameValueCollection.AllKeys)
{
SetParameter(key, nameValueCollection[key]);
};
}
}

/// <summary>
Expand Down

Large diffs are not rendered by default.

This file was deleted.

5 changes: 0 additions & 5 deletions src/Microsoft.IdentityModel.Protocols/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,3 @@
#if NET6_0_OR_GREATER
[assembly: SuppressMessage("Globalization", "CA1307:Specify StringComparison", Justification = "Adding StringComparison.Ordinal adds a performance penalty.", Scope = "member", Target = "~M:Microsoft.IdentityModel.Protocols.AuthenticationProtocolMessage.BuildRedirectUrl~System.String")]
#endif

[assembly: SuppressMessage("Design", "CA1031:Do not catch general exception types",
Justification = "Background thread needs to never throw an unhandled exception.",
Scope = "member",
Target = "~M:Microsoft.IdentityModel.Protocols.ConfigurationManager`1.UpdateCurrentConfigurationUsingSignals")]
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Microsoft.IdentityModel.Protocols.ConfigurationManager<T>.TelemetryClient -> Microsoft.IdentityModel.Telemetry.ITelemetryClient
Microsoft.IdentityModel.Protocols.ConfigurationManager<T>.TimeProvider -> System.TimeProvider
Microsoft.IdentityModel.Protocols.ConfigurationManager<T>._onBackgroundTaskFinish -> System.Action
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.HttpVersion.get -> System.Version
Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.HttpVersion.set -> void
Microsoft.IdentityModel.Protocols.ConfigurationManager<T>.ShutdownBackgroundTask() -> void
12 changes: 4 additions & 8 deletions src/Microsoft.IdentityModel.Tokens/AppContextSwitches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,14 @@ internal static class AppContextSwitches

internal static bool UseRfcDefinitionOfEpkAndKid => _useRfcDefinitionOfEpkAndKid ??= (AppContext.TryGetSwitch(UseRfcDefinitionOfEpkAndKidSwitch, out bool isEnabled) && isEnabled);

/// <summary>
/// Enabling this switch will cause the configuration manager to block other requests to GetConfigurationAsync if a request is already in progress.
/// The default configuration refresh behavior is if a request is already in progress, the current configuration will be returned until the ongoing request is completed on
/// a background thread.
/// </summary>

internal const string UpdateConfigAsBlockingSwitch = "Switch.Microsoft.IdentityModel.UpdateConfigAsBlocking";

private static bool? _updateConfigAsBlockingCall;

/// <summary>
/// Unused, part of a previous release. This is a friend, so we cannot remove.
/// </summary>
internal static bool UpdateConfigAsBlocking => _updateConfigAsBlockingCall ??= (AppContext.TryGetSwitch(UpdateConfigAsBlockingSwitch, out bool blockingCall) && blockingCall);

/// <summary>
Expand All @@ -97,9 +96,6 @@ internal static void ResetAllSwitches()

_useRfcDefinitionOfEpkAndKid = null;
AppContext.SetSwitch(UseRfcDefinitionOfEpkAndKidSwitch, false);

_updateConfigAsBlockingCall = null;
AppContext.SetSwitch(UpdateConfigAsBlockingSwitch, false);
}
}
}
1 change: 0 additions & 1 deletion src/Microsoft.IdentityModel.Tokens/EventBasedLRUCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,6 @@ internal void WaitForProcessing()
while (!_eventQueue.IsEmpty)
{
}
;
}

#endregion
Expand Down
3 changes: 0 additions & 3 deletions src/Microsoft.IdentityModel.Tokens/InternalAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ static Microsoft.IdentityModel.Tokens.Utility.SerializeAsSingleCommaDelimitedStr
static Microsoft.IdentityModel.Tokens.ValidationError.GetCurrentStackFrame(string filePath = "", int lineNumber = 0, int skipFrames = 1) -> System.Diagnostics.StackFrame
static readonly Microsoft.IdentityModel.Telemetry.TelemetryDataRecorder.ConfigurationManagerCounter -> System.Diagnostics.Metrics.Counter<long>
static readonly Microsoft.IdentityModel.Telemetry.TelemetryDataRecorder.TotalDurationHistogram -> System.Diagnostics.Metrics.Histogram<long>
static readonly Microsoft.IdentityModel.Tokens.IssuerValidationSource.IssuerMatchedConfiguration -> Microsoft.IdentityModel.Tokens.IssuerValidationSource
static readonly Microsoft.IdentityModel.Tokens.IssuerValidationSource.IssuerMatchedValidationParameters -> Microsoft.IdentityModel.Tokens.IssuerValidationSource
static readonly Microsoft.IdentityModel.Tokens.IssuerValidationSource.NotValidated -> Microsoft.IdentityModel.Tokens.IssuerValidationSource
static readonly Microsoft.IdentityModel.Tokens.LoggingEventId.TokenValidationFailed -> Microsoft.Extensions.Logging.EventId
static readonly Microsoft.IdentityModel.Tokens.LoggingEventId.TokenValidationSucceeded -> Microsoft.Extensions.Logging.EventId
static readonly Microsoft.IdentityModel.Telemetry.TelemetryDataRecorder.ConfigurationManagerCounter -> System.Diagnostics.Metrics.Counter<long>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ internal void IncrementConfigurationRefreshRequestCounter(
string operationStatus,
Exception exception);

// Unused, this was part of a previous release, since it is a friend,
// it cannot be removed.
internal void LogBackgroundConfigurationRefreshFailure(
string metadataAddress,
Exception exception);
Expand Down
18 changes: 4 additions & 14 deletions src/Microsoft.IdentityModel.Tokens/Telemetry/TelemetryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.IdentityModel.Logging;
using Microsoft.IdentityModel.Tokens;
Expand All @@ -16,19 +15,13 @@ internal class TelemetryClient : ITelemetryClient
{
public string ClientVer = IdentityModelTelemetryUtil.ClientVer;

private KeyValuePair<string, object> _blockingTagValue = new(
TelemetryConstants.BlockingTypeTag,
AppContextSwitches.UpdateConfigAsBlocking.ToString()
);

public void IncrementConfigurationRefreshRequestCounter(string metadataAddress, string operationStatus)
{
var tagList = new TagList()
{
{ TelemetryConstants.IdentityModelVersionTag, ClientVer },
{ TelemetryConstants.MetadataAddressTag, metadataAddress },
{ TelemetryConstants.OperationStatusTag, operationStatus },
_blockingTagValue
{ TelemetryConstants.OperationStatusTag, operationStatus }
};

TelemetryDataRecorder.IncrementConfigurationRefreshRequestCounter(tagList);
Expand All @@ -41,8 +34,7 @@ public void IncrementConfigurationRefreshRequestCounter(string metadataAddress,
{ TelemetryConstants.IdentityModelVersionTag, ClientVer },
{ TelemetryConstants.MetadataAddressTag, metadataAddress },
{ TelemetryConstants.OperationStatusTag, operationStatus },
{ TelemetryConstants.ExceptionTypeTag, exception.GetType().ToString() },
_blockingTagValue
{ TelemetryConstants.ExceptionTypeTag, exception.GetType().ToString() }
};

TelemetryDataRecorder.IncrementConfigurationRefreshRequestCounter(tagList);
Expand All @@ -54,7 +46,6 @@ public void LogConfigurationRetrievalDuration(string metadataAddress, TimeSpan o
{
{ TelemetryConstants.IdentityModelVersionTag, ClientVer },
{ TelemetryConstants.MetadataAddressTag, metadataAddress },
_blockingTagValue
};

long durationInMilliseconds = (long)operationDuration.TotalMilliseconds;
Expand All @@ -67,8 +58,7 @@ public void LogConfigurationRetrievalDuration(string metadataAddress, TimeSpan o
{
{ TelemetryConstants.IdentityModelVersionTag, ClientVer },
{ TelemetryConstants.MetadataAddressTag, metadataAddress },
{ TelemetryConstants.ExceptionTypeTag, exception.GetType().ToString() },
_blockingTagValue
{ TelemetryConstants.ExceptionTypeTag, exception.GetType().ToString() }
};

long durationInMilliseconds = (long)operationDuration.TotalMilliseconds;
Expand All @@ -84,7 +74,7 @@ public void LogBackgroundConfigurationRefreshFailure(
{ TelemetryConstants.IdentityModelVersionTag, ClientVer },
{ TelemetryConstants.MetadataAddressTag, metadataAddress },
{ TelemetryConstants.ExceptionTypeTag, exception.GetType().ToString() },
_blockingTagValue
{ TelemetryConstants.BlockingTypeTag, AppContextSwitches.UpdateConfigAsBlocking.ToString() }
};

TelemetryDataRecorder.IncrementBackgroundConfigurationRefreshFailureCounter(tagList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ internal class TelemetryDataRecorder
/// <summary>
/// Counter to capture configuration refresh requests to ConfigurationManager.
/// </summary>
internal static readonly Counter<long> ConfigurationManagerCounter = IdentityModelMeter.CreateCounter<long>(IdentityModelConfigurationManagerCounterName, description: IdentityModelConfigurationManagerCounterDescription);
internal const string IdentityModelConfigurationManagerCounterName = "IdentityModelConfigurationManager";
internal const string IdentityModelConfigurationManagerCounterDescription = "Counter capturing configuration manager operations.";
internal static readonly Counter<long> ConfigurationManagerCounter = IdentityModelMeter.CreateCounter<long>(IdentityModelConfigurationManagerCounterName, description: IdentityModelConfigurationManagerCounterDescription);

/// <summary>
/// Counter to capture background refresh failures in the ConfigurationManager.
Expand Down
Loading

0 comments on commit 414bf24

Please sign in to comment.