From a4c45262fb8549bdb4f5e4f76b16f98a795211ae Mon Sep 17 00:00:00 2001 From: Kahbazi Date: Sat, 2 May 2020 20:41:51 +0430 Subject: [PATCH] Add AuthenticationDisplayName to HttpSys (#21410) * Add AuthenticationDisplayName to HttpSys * update reference assembly * Update Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs * Trigger build --- .../ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs | 1 + src/Servers/HttpSys/src/AuthenticationManager.cs | 5 +++++ src/Servers/HttpSys/src/MessagePump.cs | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Servers/HttpSys/ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs b/src/Servers/HttpSys/ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs index 98e383a676..1fe19e1972 100644 --- a/src/Servers/HttpSys/ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs +++ b/src/Servers/HttpSys/ref/Microsoft.AspNetCore.Server.HttpSys.netcoreapp.cs @@ -15,6 +15,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys { internal AuthenticationManager() { } public bool AllowAnonymous { get { throw null; } set { } } + public string AuthenticationDisplayName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public bool AutomaticAuthentication { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } public Microsoft.AspNetCore.Server.HttpSys.AuthenticationSchemes Schemes { get { throw null; } set { } } } diff --git a/src/Servers/HttpSys/src/AuthenticationManager.cs b/src/Servers/HttpSys/src/AuthenticationManager.cs index 9b54f0ab0f..f8ffc49af1 100644 --- a/src/Servers/HttpSys/src/AuthenticationManager.cs +++ b/src/Servers/HttpSys/src/AuthenticationManager.cs @@ -61,6 +61,11 @@ namespace Microsoft.AspNetCore.Server.HttpSys /// public bool AutomaticAuthentication { get; set; } = true; + /// + /// Sets the display name shown to users on login pages. The default is null. + /// + public string AuthenticationDisplayName { get; set; } + internal void SetUrlGroupSecurity(UrlGroup urlGroup) { Debug.Assert(_urlGroup == null, "SetUrlGroupSecurity called more than once."); diff --git a/src/Servers/HttpSys/src/MessagePump.cs b/src/Servers/HttpSys/src/MessagePump.cs index cc90362e7a..8de84fbb05 100644 --- a/src/Servers/HttpSys/src/MessagePump.cs +++ b/src/Servers/HttpSys/src/MessagePump.cs @@ -48,7 +48,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys if (_options.Authentication.Schemes != AuthenticationSchemes.None) { - authentication.AddScheme(new AuthenticationScheme(HttpSysDefaults.AuthenticationScheme, displayName: null, handlerType: typeof(AuthenticationHandler))); + authentication.AddScheme(new AuthenticationScheme(HttpSysDefaults.AuthenticationScheme, displayName: _options.Authentication.AuthenticationDisplayName, handlerType: typeof(AuthenticationHandler))); } Features = new FeatureCollection();