Skip to content
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

add net461 target for cache extensions #737

Merged
merged 3 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Microsoft.Identity.Web/ClaimsPrincipalExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
29 changes: 26 additions & 3 deletions src/Microsoft.Identity.Web/Microsoft.Identity.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>


<PropertyGroup>
<TargetFrameworks>netcoreapp3.1; net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1; net472; net5.0</TargetFrameworks>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../../build/MSAL.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand All @@ -60,6 +59,11 @@
<DefineConstants>$(DefineConstants);DOTNET_50_AND_ABOVE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">
<DefineConstants>$(DefineConstants);DOTNET_472</DefineConstants>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

<PropertyGroup>
<!-- The MSAL.snk has both private and public keys -->
<DelaySign>false</DelaySign>
Expand All @@ -79,10 +83,29 @@
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="3.1.8" />
</ItemGroup>

<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net472' ">
<Compile Remove="*.cs"/>
<Compile Include="ClaimsPrincipalExtensions.cs" />
<Compile Remove="AppServicesAuth\**" />
<Compile Remove="CertificateManagement\**" />
<Compile Remove="DownstreamWebApiSupport\**" />
<Compile Remove="InstanceDiscovery\**" />
<Compile Remove="Resource\**" />
<Compile Remove="WebApiExtensions\**" />
<Compile Remove="WebAppExtensions\**" />
<Compile Remove="TokenCacheProviders\Session\**" />
<Compile Remove="TokenCacheProviders\Distributed\DistributedTokenCacheAdapterExtension.cs" />
<Compile Remove="TokenCacheProviders\InMemory\InMemoryTokenCacheProviderExtension.cs" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.1.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net472' ">
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.1.0" />
<PackageReference Include="Azure.Identity" Version="1.2.3" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Options;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1; net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1; net472; net5.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../../build/MSAL.snk</AssemblyOriginatorKeyFile>
Expand All @@ -22,6 +22,13 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472' ">
<Compile Remove="Mocks\LoggerMock.cs" />
<Compile Remove="TestHelpers\HttpContextUtilities.cs" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.Identity.Web\Microsoft.Identity.Web.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down