From 4566cf9fdb322c6722dbe45b298f190e49541c42 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 20 Apr 2017 12:42:12 -0700 Subject: [PATCH] Add DisplayName to scheme --- .../AuthenticationScheme.cs | 9 ++++++++- .../AuthenticationSchemeBuilder.cs | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationScheme.cs b/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationScheme.cs index 77bd9e6d..79698775 100644 --- a/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationScheme.cs +++ b/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationScheme.cs @@ -16,8 +16,9 @@ public class AuthenticationScheme /// Constructor. /// /// The name for the authentication scheme. + /// The display name for the authentication scheme. /// The type that handles this scheme. - public AuthenticationScheme(string name, Type handlerType) + public AuthenticationScheme(string name, string displayName, Type handlerType) { if (name == null) { @@ -34,6 +35,7 @@ public AuthenticationScheme(string name, Type handlerType) Name = name; HandlerType = handlerType; + DisplayName = displayName; } /// @@ -41,6 +43,11 @@ public AuthenticationScheme(string name, Type handlerType) /// public string Name { get; } + /// + /// The display name for the scheme. Null is valid and used for non user facing schemes. + /// + public string DisplayName { get; } + /// /// The type that handles this scheme. /// diff --git a/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationSchemeBuilder.cs b/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationSchemeBuilder.cs index e1ea0cbc..30e843c0 100644 --- a/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationSchemeBuilder.cs +++ b/src/Microsoft.AspNetCore.Authentication.Abstractions/AuthenticationSchemeBuilder.cs @@ -24,6 +24,11 @@ public AuthenticationSchemeBuilder(string name) /// public string Name { get; } + /// + /// The display name for the scheme being built. + /// + public string DisplayName { get; set; } + /// /// The type responsible for this scheme. /// @@ -33,6 +38,6 @@ public AuthenticationSchemeBuilder(string name) /// Builds the instance. /// /// - public AuthenticationScheme Build() => new AuthenticationScheme(Name, HandlerType); + public AuthenticationScheme Build() => new AuthenticationScheme(Name, DisplayName, HandlerType); } }