Fix OidcIdpSignedAssertionLoader to remove hard dependency on IConfiguration registration - #3414
Conversation
…tion dependency fix Co-authored-by: jmprieur <13203188+jmprieur@users.noreply.github.com>
…Configuration dependency Co-authored-by: jmprieur <13203188+jmprieur@users.noreply.github.com>
Jean-Marc Prieur (jmprieur)
left a comment
There was a problem hiding this comment.
Great start
- we should use the high performance logging in .NET
- we need to add unit test for the case where the configuration is null!
…sertionLoader Co-authored-by: jmprieur <13203188+jmprieur@users.noreply.github.com>
Both items addressed in commit 62ef492:
All tests are passing and the implementation follows the high-performance logging patterns used elsewhere in the codebase. |
Jean-Marc Prieur (jmprieur)
left a comment
There was a problem hiding this comment.
LGTM
I've some questions and suggestions Copilot
…and test code Co-authored-by: jmprieur <13203188+jmprieur@users.noreply.github.com>
|
Copilot you removed too much:
|
… project Co-authored-by: jmprieur <13203188+jmprieur@users.noreply.github.com>
You're absolutely right - I accidentally removed the InternalsVisibleTo.cs file when addressing the previous feedback. The file has been restored with the exact same content as before in commit 84f632b. The assembly attribute is required for the test projects to access internal members of the OidcFIC assembly. |
Jean-Marc Prieur (jmprieur)
left a comment
There was a problem hiding this comment.
LGTM
Thanks
Problem
The
OidcIdpSignedAssertionLoaderclass requiredIConfigurationto be explicitly registered in the service collection, causing aSystem.InvalidOperationExceptionwhen trying to resolveICustomSignedAssertionProviderimplementations:Error message:
Solution
Following the design proposal from Jean-Marc Prieur (@jmprieur), this PR implements:
OidcIdpSignedAssertionLoaderconstructor to acceptIServiceProviderinstead ofIConfigurationIConfigurationfrom service provider only when neededmicrosoftIdentityApplicationOptions.Instanceis null or emptymicrosoftIdentityApplicationOptions.Authorityequals "//v2.0"IConfigurationis needed but not availableChanges Made
Before
After
Benefits
IConfigurationregistrationTesting
TokenAcquirerFactory.GetDefaultInstance()registersIConfigurationIConfigurationis not registered will work unless configuration binding is specifically neededIConfigurationis not available, a helpful error message with troubleshooting link is providedFixes #3411.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.