diff --git a/src/Microsoft.Identity.Web/ClaimsPrincipalExtensions.cs b/src/Microsoft.Identity.Web/ClaimsPrincipalExtensions.cs index 365d02869..b2e00b236 100644 --- a/src/Microsoft.Identity.Web/ClaimsPrincipalExtensions.cs +++ b/src/Microsoft.Identity.Web/ClaimsPrincipalExtensions.cs @@ -209,5 +209,12 @@ public static class ClaimsPrincipalExtensions return claimsPrincipal.FindFirstValue(ClaimConstants.NameIdentifierId); } + +#if NET472 + private static string? FindFirstValue(this ClaimsPrincipal claimsPrincipal, string type) + { + return claimsPrincipal.FindFirst(type)?.Value; + } +#endif } } diff --git a/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj b/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj index b0f23c0ba..c3f442c98 100644 --- a/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj +++ b/src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj @@ -48,9 +48,8 @@ - - netcoreapp3.1; net5.0 + netcoreapp3.1; net472; net5.0 true ../../build/MSAL.snk true @@ -61,6 +60,11 @@ $(DefineConstants);DOTNET_50_AND_ABOVE + + $(DefineConstants);DOTNET_472 + 8.0 + + false @@ -80,10 +84,29 @@ - + + + + + + + + + + + + + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Microsoft.Identity.Web/TokenCacheProviders/InMemory/MsalMemoryTokenCacheProvider.cs b/src/Microsoft.Identity.Web/TokenCacheProviders/InMemory/MsalMemoryTokenCacheProvider.cs index c80eeb873..34386c0a0 100644 --- a/src/Microsoft.Identity.Web/TokenCacheProviders/InMemory/MsalMemoryTokenCacheProvider.cs +++ b/src/Microsoft.Identity.Web/TokenCacheProviders/InMemory/MsalMemoryTokenCacheProvider.cs @@ -3,7 +3,6 @@ using System; using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; diff --git a/tests/Microsoft.Identity.Web.Test.Common/Microsoft.Identity.Web.Test.Common.csproj b/tests/Microsoft.Identity.Web.Test.Common/Microsoft.Identity.Web.Test.Common.csproj index 3656d8698..5a6b82ae9 100644 --- a/tests/Microsoft.Identity.Web.Test.Common/Microsoft.Identity.Web.Test.Common.csproj +++ b/tests/Microsoft.Identity.Web.Test.Common/Microsoft.Identity.Web.Test.Common.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1; net5.0 + netcoreapp3.1; net472; net5.0 false true ../../build/MSAL.snk @@ -22,6 +22,13 @@ + + + + + + + diff --git a/tests/Microsoft.Identity.Web.Test.Common/TestHelpers/MsalTestTokenCacheProvider.cs b/tests/Microsoft.Identity.Web.Test.Common/TestHelpers/MsalTestTokenCacheProvider.cs index aed2e2e47..2516efa7c 100644 --- a/tests/Microsoft.Identity.Web.Test.Common/TestHelpers/MsalTestTokenCacheProvider.cs +++ b/tests/Microsoft.Identity.Web.Test.Common/TestHelpers/MsalTestTokenCacheProvider.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Microsoft.Identity.Web.TokenCacheProviders;