-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for #2371 #2374
Fix for #2371 #2374
Conversation
In .NET 5+, we now use the DefaultTokenAcquisitionHost (the host for SDK apps) instead of the Asp.NET core one, when the service collection was not initialized by ASP.NET Core (that is the `IWebHostEnvironment` is not present in the collection. If developers want the ASP.NET Core host, they would need to use the WebApplication.CreateBuilder().Services instead of instanciating a simple service collection.
src/Microsoft.Identity.Web.TokenAcquisition/ServiceCollectionExtensions.cs
Show resolved
Hide resolved
@@ -33,6 +33,16 @@ public TokenAcquirer() | |||
TokenAcquirerFactory.ResetDefaultInstance(); // Test only | |||
} | |||
|
|||
[Fact] | |||
public void TokenAcquirerFactoryDoesNotUseAspNetCoreHost() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test project only tests NET7.0 and NET8.0 it will never test netstandard, which is part of the change.
Would it make sense to add netstandard as part of the target to the test project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer needed with the fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well we should still test the whole library for netstandard2.0 dont you think? It`s a release target after all.
- Adds a PrincipalExtensionsForSecurityTokens.GetBootstrapToken method that extracts a Security token from the bootstrap context (+unit tests) - In Web APIs, GetAuthenticationResultForUserAsync tries the BootstrapContext first
src/Microsoft.Identity.Web.TokenAcquisition/PrincipalExtensionsForSecurityTokens.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Identity.Web.TokenAcquisition/PrincipalExtensionsForSecurityTokens.cs
Outdated
Show resolved
Hide resolved
tests/Microsoft.Identity.Web.Test/PrincipalExtensionsForSecurityTokensTests.cs
Show resolved
Hide resolved
tests/Microsoft.Identity.Web.Test/PrincipalExtensionsForSecurityTokensTests.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Supports extended strings (StringsValues) as the BootstrapContext
…sForSecurityTokens.cs Co-authored-by: jennyf19 <jeferrie@microsoft.com>
…sForSecurityTokens.cs Co-authored-by: jennyf19 <jeferrie@microsoft.com>
…tyTokensTests.cs Co-authored-by: jennyf19 <jeferrie@microsoft.com>
Fix for #2371
Description
In .NET 5+, we now use the DefaultTokenAcquisitionHost (the host for SDK apps) instead of the Asp.NET core one, when the service collection was not initialized by ASP.NET Core (that is the
IWebHostEnvironment
is not present in the collection.If developers want the ASP.NET Core host, they would need to use the WebApplication.CreateBuilder().Services instead of instanciating a simple service collection.
Fixes #2371