Switch back to netstandard2.0

This commit is contained in:
Hao Kung 2017-05-24 11:54:06 -07:00 committed by Javier Calvarro Nelson
parent 8682cc74c8
commit 45f9780d32
30 changed files with 78 additions and 51 deletions

View File

@ -15,9 +15,9 @@
<ItemGroup>
<PackageReference Include="Internal.AspNetCore.Sdk" Version="$(InternalAspNetCoreSdkVersion)" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)'=='.NETFramework'">
<PackageReference Include="NETStandard.Library.NETFramework" Version="$(NETStandardLibraryNETFrameworkVersion)" />
<PackageReference Include="NETStandard.Library.NETFramework" Version="$(NETStandardLibraryNETFrameworkVersion)" PrivateAssets="All" />
</ItemGroup>
</Project>

View File

@ -6,7 +6,7 @@
<IdentityEFCompatVersion>2.2.1</IdentityEFCompatVersion>
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
<MoqVersion>4.7.1</MoqVersion>
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
<NETStandardLibraryNETFrameworkVersion>2.0.0-*</NETStandardLibraryNETFrameworkVersion>
<OwinSecurityVersion>3.0.1</OwinSecurityVersion>
<TestSdkVersion>15.3.0-*</TestSdkVersion>

View File

@ -1,10 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\build\dependencies.props" />
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<Description>Identity sample MVC application on ASP.NET Core</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
<UserSecretsId>aspnetcore-b3d20cbe-418e-4bf2-a0f4-57f91d067e07</UserSecretsId>
</PropertyGroup>

View File

@ -3,7 +3,6 @@ using IdentitySample.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@ -47,9 +46,6 @@ namespace IdentitySample
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();

View File

@ -79,6 +79,7 @@ namespace Microsoft.AspNetCore.Diagnostics.Identity.Service
await _next(context);
void CreateDevelopmentCertificate()
{
#if NETCOREAPP2_0
using (var rsa = RSA.Create(2048))
{
var signingRequest = new CertificateRequest(
@ -107,6 +108,10 @@ namespace Microsoft.AspNetCore.Diagnostics.Identity.Service
context.Response.StatusCode = StatusCodes.Status204NoContent;
};
}
#elif NETSTANDARD2_0
#else
#error The target frameworks need to be updated.
#endif
}
bool FoundDeveloperCertificate()

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core Identity Service Diagnostics Middleware.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core Identity provider that uses Entity Framework Core.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;entityframeworkcore;identity;membership</PackageTags>
</PropertyGroup>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core common types defining the main abstractions for Identity Service.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>

View File

@ -43,9 +43,24 @@ namespace Microsoft.AspNetCore.Identity.Service
return;
}
public static RSA CreateRsaAlgorithm() => RSA.Create(2048);
public static SHA256 CreateSHA256()
{
SHA256 sha256 = null;
try
{
sha256 = SHA256.Create();
return sha256;
}
// SHA256.Create is documented to throw this exception on FIPS compliant machines.
// See: https://msdn.microsoft.com/enus/library/z08hz7ad%28v=vs.110%29.aspx?f=255&MSPPError=2147217396
catch (System.Reflection.TargetInvocationException)
{
// Fallback to a FIPS compliant SHA256 algorithm.
sha256 = new SHA256CryptoServiceProvider();
}
public static SHA256 CreateSHA256() => SHA256.Create();
return sha256;
}
public static RSAParameters GetRSAParameters(SigningCredentials credentials)
{
@ -82,7 +97,7 @@ namespace Microsoft.AspNetCore.Identity.Service
var rsaSecurityKey = credentials.Key as RsaSecurityKey;
// Check that the key has either an Asymetric Algorithm assigned or that at least
// one of the RSA parameters are initialized to consider the key "valid".
if (rsaSecurityKey != null &&
if (rsaSecurityKey != null &&
(rsaSecurityKey.Rsa != null || rsaSecurityKey.Parameters.Modulus != null))
{
return JsonWebAlgorithmsKeyTypes.RSA;

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core common types implementing the main abstractions for Identity Service.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>
@ -16,7 +16,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Authentication" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(AspNetCoreVersion)" />
<PackageReference Include="System.ValueTuple" Version="$(CoreFxVersion)" />

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core Identity Service implementation based on ASP.NET Core Identity.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core Identity Service in process client.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core Identity Service integration for ASP.NET Core MVC.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>Shared test suite for Asp.Net Identity Core as a service store implementations.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;identity</PackageTags>
</PropertyGroup>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core Identity Service implementation based on Entity Framework.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore</PackageTags>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>Shared test suite for Asp.Net Identity Core store implementations.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;identity;membership</PackageTags>
</PropertyGroup>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. ASP.NET Core Identity allows you to add login features to your application and makes it easy to customize data about the logged in user.</Description>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;identity;membership</PackageTags>
<EnableApiCheck>false</EnableApiCheck>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. ASP.NET Core Identity allows you to add login features to your application and makes it easy to customize data about the logged in user.</Description>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;identity;membership</PackageTags>
<EnableApiCheck>false</EnableApiCheck>
@ -17,8 +17,4 @@
<PackageReference Include="System.ComponentModel.Annotations" Version="$(CoreFxVersion)" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.Security.Claims" Version="$(CoreFxVersion)" />
</ItemGroup>
</Project>

View File

@ -4,7 +4,7 @@
<PropertyGroup>
<Description>ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. ASP.NET Core Identity allows you to add login features to your application and makes it easy to customize data about the logged in user.</Description>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;identity;membership</PackageTags>
<EnableApiCheck>false</EnableApiCheck>
@ -16,11 +16,6 @@
<PackageReference Include="System.ComponentModel.Annotations" Version="$(CoreFxVersion)" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.ComponentModel.TypeConverter" Version="$(CoreFxVersion)" />
<PackageReference Include="System.Security.Claims" Version="$(CoreFxVersion)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.Extensions.Identity.Core\Microsoft.Extensions.Identity.Core.csproj" />
</ItemGroup>

View File

@ -3,7 +3,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -3,7 +3,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -3,7 +3,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -2,7 +2,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -10,14 +10,24 @@ namespace Microsoft.AspNetCore.Identity.Service
{
internal static SecurityKey CreateTestKey(string id = "Test")
{
using (var rsa = RSA.Create(2048))
var rsa = RSA.Create();
if (rsa.KeySize < 2048)
{
SecurityKey key;
var parameters = rsa.ExportParameters(includePrivateParameters: true);
key = new RsaSecurityKey(parameters);
key.KeyId = id;
return key;
rsa.KeySize = 2048;
if (rsa.KeySize < 2048 && rsa is RSACryptoServiceProvider)
{
rsa.Dispose();
rsa = new RSACryptoServiceProvider(2048);
}
}
SecurityKey key;
var parameters = rsa.ExportParameters(includePrivateParameters: true);
rsa.Dispose();
key = new RsaSecurityKey(parameters);
key.KeyId = id;
return key;
}
}
}

View File

@ -2,7 +2,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -3,7 +3,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -3,7 +3,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -3,7 +3,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -2,7 +2,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>

View File

@ -3,7 +3,8 @@
<Import Project="..\..\build\common.props" />
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>