Use fallback logic
This commit is contained in:
parent
27b34cc7e6
commit
e7845f3b37
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Net.Http.Server;
|
using Microsoft.Net.Http.Server;
|
||||||
|
|
@ -22,7 +23,8 @@ namespace MusicStore.Standalone
|
||||||
.UseStartup("MusicStore.Standalone");
|
.UseStartup("MusicStore.Standalone");
|
||||||
|
|
||||||
if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal)
|
if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal)
|
||||||
&& string.Equals(builder.GetSetting("environment"), "NtlmAuthentication", System.StringComparison.Ordinal))
|
&& string.Equals(builder.GetSetting("environment") ??
|
||||||
|
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"), "NtlmAuthentication", System.StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
// Set up NTLM authentication for WebListener like below.
|
// Set up NTLM authentication for WebListener like below.
|
||||||
// For IIS and IISExpress: Use inetmgr to setup NTLM authentication on the application vDir or
|
// For IIS and IISExpress: Use inetmgr to setup NTLM authentication on the application vDir or
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,9 @@ namespace MusicStore
|
||||||
if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal)
|
if (string.Equals(builder.GetSetting("server"), "Microsoft.AspNetCore.Server.WebListener", System.StringComparison.Ordinal)
|
||||||
&& string.Equals(builder.GetSetting("environment"), "NtlmAuthentication", System.StringComparison.Ordinal))
|
&& string.Equals(builder.GetSetting("environment"), "NtlmAuthentication", System.StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
// Set up NTLM authentication for WebListener like below.
|
if (string.Equals(builder.GetSetting("environment") ??
|
||||||
// For IIS and IISExpress: Use inetmgr to setup NTLM authentication on the application vDir or
|
Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"),
|
||||||
// modify the applicationHost.config to enable NTLM.
|
"NtlmAuthentication", System.StringComparison.Ordinal))
|
||||||
builder.UseWebListener(options =>
|
|
||||||
{
|
{
|
||||||
options.Listener.AuthenticationManager.AuthenticationSchemes = AuthenticationSchemes.NTLM;
|
options.Listener.AuthenticationManager.AuthenticationSchemes = AuthenticationSchemes.NTLM;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue