Add windows auth tests for inproc (#1385)
This commit is contained in:
parent
e477f47ba8
commit
2cd6ad6d50
|
|
@ -293,7 +293,8 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
|
|||
|
||||
ConfigureModuleAndBinding(config.Root, contentRoot, port);
|
||||
|
||||
if (!DeploymentParameters.PublishApplicationBeforeDeployment)
|
||||
var webConfigPath = Path.Combine(contentRoot, "web.config");
|
||||
if (!DeploymentParameters.PublishApplicationBeforeDeployment && !File.Exists(webConfigPath))
|
||||
{
|
||||
// The elements normally in the web.config are in the applicationhost.config for unpublished apps.
|
||||
AddAspNetCoreElement(config.Root);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
response = await deploymentResult.HttpClient.GetAsync("/Auth");
|
||||
responseText = await response.Content.ReadAsStringAsync();
|
||||
|
||||
Assert.True("backcompat;Windows".Equals(responseText) || "latest;null".Equals(responseText), "Auth");
|
||||
Assert.True("null".Equals(responseText), "Auth");
|
||||
|
||||
Assert.Equal(
|
||||
$"ContentRootPath {deploymentResult.ContentRoot}" + Environment.NewLine +
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
=> TestMatrix.ForServers(DeployerSelector.ServerType)
|
||||
.WithTfms(Tfm.NetCoreApp22, Tfm.Net461)
|
||||
.WithAllApplicationTypes()
|
||||
.WithAllAncmVersions();
|
||||
.WithAllAncmVersions()
|
||||
.WithAllHostingModels();
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(TestVariants))]
|
||||
|
|
@ -41,7 +42,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
var response = await deploymentResult.HttpClient.GetAsync("/Auth");
|
||||
var responseText = await response.Content.ReadAsStringAsync();
|
||||
|
||||
Assert.True("backcompat;Windows".Equals(responseText) || "latest;Windows".Equals(responseText), "Auth");
|
||||
Assert.Equal("Windows", responseText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -36,20 +36,6 @@ namespace TestSite
|
|||
|
||||
public Task BodyLimit(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize?.ToString() ?? "null");
|
||||
|
||||
public async Task Auth(HttpContext ctx)
|
||||
{
|
||||
var iisAuth = Environment.GetEnvironmentVariable("ASPNETCORE_IIS_HTTPAUTH");
|
||||
var authProvider = ctx.RequestServices.GetService<IAuthenticationSchemeProvider>();
|
||||
var authScheme = (await authProvider.GetAllSchemesAsync()).SingleOrDefault();
|
||||
if (string.IsNullOrEmpty(iisAuth))
|
||||
{
|
||||
await ctx.Response.WriteAsync("backcompat;" + (authScheme?.Name ?? "null"));
|
||||
}
|
||||
else
|
||||
{
|
||||
await ctx.Response.WriteAsync("latest;" + (authScheme?.Name ?? "null"));
|
||||
}
|
||||
}
|
||||
|
||||
public Task HelloWorld(HttpContext ctx) => ctx.Response.WriteAsync("Hello World");
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
|
@ -33,5 +35,13 @@ namespace TestSite
|
|||
|
||||
await ctx.Response.WriteAsync("Hello World");
|
||||
}
|
||||
|
||||
public async Task Auth(HttpContext ctx)
|
||||
{
|
||||
var authProvider = ctx.RequestServices.GetService<IAuthenticationSchemeProvider>();
|
||||
var authScheme = (await authProvider.GetAllSchemesAsync()).SingleOrDefault();
|
||||
|
||||
await ctx.Response.WriteAsync(authScheme?.Name ?? "null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue