Skip to content

Conversation

keegan-caruso
Copy link
Contributor

Switch for metadata refresh to be blocking

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • If any gains or losses in performance are possible, you've included benchmarks for your changes. More info
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Summary of the changes (Less than 80 chars)

Description

Adds the ability for the metadata refresh to be done as a blocking call, as per 8.0.1 behavior.

This is done through the 'Switch.Microsoft.IdentityModel.UpdateConfigAsBlocking'.

If set, configuration calls will be blocking on update, and exceptions when requesting new metadata will be returned to the caller

Fixes #3192

…ll, as per 8.0.1 behavior.

This is done through the Switch.Microsoft.IdentityModel.UpdateConfigAsBlocking switch.

If set, configuration calls will be blocking on update, and exceptions when requesting new metadata will be returned to the caller
@keegan-caruso keegan-caruso requested a review from a team as a code owner April 4, 2025 19:57
GeoK
GeoK previously approved these changes Apr 4, 2025
Copy link

github-actions bot commented Apr 4, 2025

Summary

Summary
Generated on: 4/4/2025 - 10:23:10 PM
Coverage date: 4/4/2025 - 10:12:22 PM - 4/4/2025 - 10:22:44 PM
Parser: MultiReport (60x Cobertura)
Assemblies: 1
Classes: 7
Files: 2
Line coverage: 80.3% (620 of 772)
Covered lines: 620
Uncovered lines: 152
Coverable lines: 772
Total lines: 483
Branch coverage: 67.8% (228 of 336)
Covered branches: 228
Total branches: 336
Method coverage: Feature is only available for sponsors

Coverage

Microsoft.IdentityModel.JsonWebTokens - 80.3%
Name Line Branch
Microsoft.IdentityModel.JsonWebTokens 80.3% 67.8%
Microsoft.IdentityModel.JsonWebTokens.JwtTokenUtilities 100%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJwsRegex_0
81.4% 67.6%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJwsRegex_0
81.4% 67.6%

jennyf19
jennyf19 previously approved these changes Apr 5, 2025
@jmprieur jmprieur requested a review from Copilot April 7, 2025 18:26
jmprieur
jmprieur previously approved these changes Apr 7, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

src/Microsoft.IdentityModel.Tokens/AppContextSwitches.cs:105

  • A corresponding boolean property 'UpdateConfigAsBlocking' (similar to 'UseRfcDefinitionOfEpkAndKid') should be implemented to allow proper evaluation of the blocking switch.
AppContext.SetSwitch(UpdateConfigAsBlockingSwitch, false);

src/Microsoft.IdentityModel.Protocols/Configuration/ConfigurationManager_Blocking.cs:71

  • [nitpick] Consider reusing a static Random instance or using a thread-safe alternative for jitter calculation to avoid potential issues with seed duplication during rapid successive calls.
TimeSpan _bootstrapRefreshIntervalWithJitter = TimeSpan.FromSeconds(new Random().Next((int)_bootstrapRefreshInterval.TotalSeconds));

@keegan-caruso keegan-caruso dismissed stale reviews from jmprieur, jennyf19, and GeoK via 268e0c2 April 7, 2025 20:41
Copy link

github-actions bot commented Apr 7, 2025

Summary

Summary
Generated on: 4/7/2025 - 8:56:05 PM
Coverage date: 4/7/2025 - 8:44:48 PM - 4/7/2025 - 8:55:36 PM
Parser: MultiReport (60x Cobertura)
Assemblies: 1
Classes: 7
Files: 2
Line coverage: 80.3% (620 of 772)
Covered lines: 620
Uncovered lines: 152
Coverable lines: 772
Total lines: 483
Branch coverage: 67.8% (228 of 336)
Covered branches: 228
Total branches: 336
Method coverage: Feature is only available for sponsors

Coverage

Microsoft.IdentityModel.JsonWebTokens - 80.3%
Name Line Branch
Microsoft.IdentityModel.JsonWebTokens 80.3% 67.8%
Microsoft.IdentityModel.JsonWebTokens.JwtTokenUtilities 100%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated 80.3% 67.8%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F12A1AEDDDFE32BA
DF4DBFF323AF1BCB48B9F9721B7CD3E05F5E034CF225E3DF8__CreateJwsRegex_0
81.4% 67.6%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJweRegex_1
79.2% 68%
System.Text.RegularExpressions.Generated.<RegexGenerator_g>F334844C618E00D3
CEC5D3FE0D00CF0141BBEE98635313BB2CB8D3921464CE05A__CreateJwsRegex_0
81.4% 67.6%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ConfigurationManager.GetConfiguration() no longer performs blocking call, nor throw exception

6 participants