Merge branch 'rel/2.0.0' into dev
This commit is contained in:
commit
cc31406913
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Server.IISIntegration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
|
@ -15,13 +17,14 @@ namespace IISSample
|
|||
// These two middleware are registered via an IStartupFilter in UseIISIntegration but you can configure them here.
|
||||
services.Configure<IISOptions>(options =>
|
||||
{
|
||||
options.AuthenticationDisplayName = "Windows Auth";
|
||||
});
|
||||
services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory)
|
||||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerfactory, IAuthenticationSchemeProvider authSchemeProvider)
|
||||
{
|
||||
var logger = loggerfactory.CreateLogger("Requests");
|
||||
|
||||
|
|
@ -50,6 +53,8 @@ namespace IISSample
|
|||
await context.Response.WriteAsync(Environment.NewLine);
|
||||
|
||||
await context.Response.WriteAsync("User: " + context.User.Identity.Name + Environment.NewLine);
|
||||
var scheme = await authSchemeProvider.GetSchemeAsync(IISDefaults.AuthenticationScheme);
|
||||
await context.Response.WriteAsync("DisplayName: " + scheme?.DisplayName + Environment.NewLine);
|
||||
await context.Response.WriteAsync(Environment.NewLine);
|
||||
|
||||
await context.Response.WriteAsync("Headers:" + Environment.NewLine);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
|
||||
if (_options.ForwardWindowsAuthentication)
|
||||
{
|
||||
authentication.AddScheme(new AuthenticationScheme(IISDefaults.AuthenticationScheme, displayName: null, handlerType: typeof(AuthenticationHandler)));
|
||||
authentication.AddScheme(new AuthenticationScheme(IISDefaults.AuthenticationScheme, _options.AuthenticationDisplayName, typeof(AuthenticationHandler)));
|
||||
}
|
||||
|
||||
_pairingToken = pairingToken;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ namespace Microsoft.AspNetCore.Builder
|
|||
/// </summary>
|
||||
public bool AutomaticAuthentication { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the display name shown to users on login pages. The default is null.
|
||||
/// </summary>
|
||||
public string AuthenticationDisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used to indicate if the authentication handler should be registered. This is only done if ANCM indicates
|
||||
/// IIS has a non-anonymous authentication enabled, or for back compat with ANCMs that did not provide this information.
|
||||
|
|
|
|||
Loading…
Reference in New Issue