Add Test to diagnose CI issues
This commit is contained in:
parent
efe0c6be7b
commit
329eed9e8d
|
|
@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Identity.Service
|
|||
{
|
||||
public class AuthorizeIntegrationTest
|
||||
{
|
||||
[Fact]
|
||||
[Fact(Skip = "https://github.com/aspnet/Identity/issues/1630")]
|
||||
public async Task Spec_Code_Sample()
|
||||
{
|
||||
// Arrange
|
||||
|
|
@ -72,7 +72,7 @@ namespace Microsoft.AspNetCore.Identity.Service
|
|||
Assert.Equal("af0ifjsldkj", stateKvp.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "https://github.com/aspnet/Identity/issues/1630")]
|
||||
public async Task Spec_IdToken_Sample()
|
||||
{
|
||||
// Arrange
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.using System;
|
||||
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace Microsoft.AspNetCore.Identity.Service
|
||||
{
|
||||
public class CryptographyIssuesTests : LoggedTest
|
||||
{
|
||||
public CryptographyIssuesTests(ITestOutputHelper output) : base(output)
|
||||
{
|
||||
}
|
||||
|
||||
[ConditionalFact(Skip = "https://github.com/aspnet/Identity/issues/1630")]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||
public void ImportRsaParameters_CLR()
|
||||
{
|
||||
RunTest(nameof(ImportRsaParameters_CLR));
|
||||
}
|
||||
|
||||
[ConditionalFact(Skip = "https://github.com/aspnet/Identity/issues/1630")]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
||||
public void ImportRsaParameters_CoreCLR()
|
||||
{
|
||||
RunTest(nameof(ImportRsaParameters_CoreCLR));
|
||||
}
|
||||
|
||||
private void RunTest(string testFlavor)
|
||||
{
|
||||
using (StartLog(out var loggerFactory, testFlavor))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger(testFlavor);
|
||||
for (var i = 0; i < 100; i++)
|
||||
{
|
||||
var key = CryptoUtilities.CreateTestKey();
|
||||
try
|
||||
{
|
||||
CryptographyHelpers.GetRSAParameters(new SigningCredentials(key, "RS256"));
|
||||
}
|
||||
catch (CryptographicException e)
|
||||
{
|
||||
LogKeyData(logger, i, key, e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void LogKeyData(ILogger logger, int i, SecurityKey key, CryptographicException e)
|
||||
{
|
||||
logger.LogCritical(e.Message);
|
||||
logger.LogCritical($"Iteration {i}:");
|
||||
logger.LogCritical($"Key length: {key.KeySize}");
|
||||
var data = key as RsaSecurityKey;
|
||||
logger.LogCritical($"RSA Key length: {data.Rsa.KeySize}");
|
||||
RSAParameters parameters = data.Rsa.ExportParameters(includePrivateParameters: true);
|
||||
LogParameter(logger, "M", parameters.Modulus);
|
||||
LogParameter(logger, "E", parameters.Exponent);
|
||||
LogParameter(logger, "D", parameters.D);
|
||||
LogParameter(logger, "P", parameters.P);
|
||||
LogParameter(logger, "Q", parameters.Q);
|
||||
LogParameter(logger, "1/Q", parameters.InverseQ);
|
||||
LogParameter(logger, "DP", parameters.DP);
|
||||
LogParameter(logger, "DQ", parameters.DQ);
|
||||
}
|
||||
|
||||
private static void LogParameter(ILogger logger, string name, byte[] parameter)
|
||||
{
|
||||
if (parameter == null)
|
||||
{
|
||||
logger.LogCritical($"Key parameter '{name}' is 'null'");
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogCritical($"Key parameter '{name}' (Base64Encoded): '{Convert.ToBase64String(parameter)}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Identity.Service
|
|||
{
|
||||
public class DefaultSigningCredentialsPolicyProviderTest
|
||||
{
|
||||
[Fact]
|
||||
[Fact(Skip="https://github.com/aspnet/Identity/issues/1630")]
|
||||
public async Task GetAllCredentialsAsync_GetsCredentialsFromAllSources()
|
||||
{
|
||||
// Arrange
|
||||
|
|
@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Identity.Service
|
|||
Assert.Equal(expected, credentials);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip="https://github.com/aspnet/Identity/issues/1630")]
|
||||
public async Task GetAllCredentialsAsync_RetrievesTheCredentialsIfAllOfThemAreExpired()
|
||||
{
|
||||
// Arrange
|
||||
|
|
@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Identity.Service
|
|||
Assert.Equal(expected, credentials);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip="https://github.com/aspnet/Identity/issues/1630")]
|
||||
public async Task GetAllCredentialsAsync_RetrievesCredentialsInOrder()
|
||||
{
|
||||
// Arrange
|
||||
|
|
@ -162,7 +162,7 @@ namespace Microsoft.AspNetCore.Identity.Service
|
|||
Assert.Equal(expected, credentials);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip="https://github.com/aspnet/Identity/issues/1630")]
|
||||
public async Task GetSigningCredentialsAsync_RetrievesTheCredentialWithEarliestExpirationAndAllowedUsage()
|
||||
{
|
||||
// Arrange
|
||||
|
|
@ -215,7 +215,7 @@ namespace Microsoft.AspNetCore.Identity.Service
|
|||
Assert.Equal(expected, signingCredential);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip="https://github.com/aspnet/Identity/issues/1630")]
|
||||
public async Task GetSigningCredentialsAsync_SkipsExpiredCredentials()
|
||||
{
|
||||
// Arrange
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
<PropertyGroup>
|
||||
<TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\Service.Core\CryptographyHelpers.cs" Link="CryptographyHelpers.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Service.Core\Microsoft.AspNetCore.Identity.Service.Core.csproj" />
|
||||
|
|
@ -9,6 +12,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="$(MicrosoftAspNetCoreTestHostPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspnetCore.Identity.Service.FunctionalTests
|
|||
{
|
||||
public class TraditionalWebApplicationTests
|
||||
{
|
||||
[ConditionalFact]
|
||||
[ConditionalFact(Skip = "https://github.com/aspnet/Identity/issues/1630")]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR, SkipReason = "https://github.com/aspnet/Identity/issues/1346")]
|
||||
public async Task CanPerform_AuthorizationCode_Flow()
|
||||
{
|
||||
|
|
@ -117,7 +117,7 @@ namespace Microsoft.AspnetCore.Identity.Service.FunctionalTests
|
|||
};
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[ConditionalFact(Skip = "https://github.com/aspnet/Identity/issues/1630")]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR, SkipReason = "https://github.com/aspnet/Identity/issues/1346")]
|
||||
public async Task CanPerform_IdToken_Flow()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue