Add DisplayName to scheme

This commit is contained in:
Hao Kung 2017-04-20 12:42:12 -07:00
parent d508c027ba
commit 4566cf9fdb
2 changed files with 14 additions and 2 deletions

View File

@ -16,8 +16,9 @@ namespace Microsoft.AspNetCore.Authentication
/// Constructor. /// Constructor.
/// </summary> /// </summary>
/// <param name="name">The name for the authentication scheme.</param> /// <param name="name">The name for the authentication scheme.</param>
/// <param name="displayName">The display name for the authentication scheme.</param>
/// <param name="handlerType">The <see cref="IAuthenticationHandler"/> type that handles this scheme.</param> /// <param name="handlerType">The <see cref="IAuthenticationHandler"/> type that handles this scheme.</param>
public AuthenticationScheme(string name, Type handlerType) public AuthenticationScheme(string name, string displayName, Type handlerType)
{ {
if (name == null) if (name == null)
{ {
@ -34,6 +35,7 @@ namespace Microsoft.AspNetCore.Authentication
Name = name; Name = name;
HandlerType = handlerType; HandlerType = handlerType;
DisplayName = displayName;
} }
/// <summary> /// <summary>
@ -41,6 +43,11 @@ namespace Microsoft.AspNetCore.Authentication
/// </summary> /// </summary>
public string Name { get; } public string Name { get; }
/// <summary>
/// The display name for the scheme. Null is valid and used for non user facing schemes.
/// </summary>
public string DisplayName { get; }
/// <summary> /// <summary>
/// The <see cref="IAuthenticationHandler"/> type that handles this scheme. /// The <see cref="IAuthenticationHandler"/> type that handles this scheme.
/// </summary> /// </summary>

View File

@ -24,6 +24,11 @@ namespace Microsoft.AspNetCore.Authentication
/// </summary> /// </summary>
public string Name { get; } public string Name { get; }
/// <summary>
/// The display name for the scheme being built.
/// </summary>
public string DisplayName { get; set; }
/// <summary> /// <summary>
/// The <see cref="IAuthenticationHandler"/> type responsible for this scheme. /// The <see cref="IAuthenticationHandler"/> type responsible for this scheme.
/// </summary> /// </summary>
@ -33,6 +38,6 @@ namespace Microsoft.AspNetCore.Authentication
/// Builds the <see cref="AuthenticationScheme"/> instance. /// Builds the <see cref="AuthenticationScheme"/> instance.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public AuthenticationScheme Build() => new AuthenticationScheme(Name, HandlerType); public AuthenticationScheme Build() => new AuthenticationScheme(Name, DisplayName, HandlerType);
} }
} }