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.
/// </summary>
/// <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>
public AuthenticationScheme(string name, Type handlerType)
public AuthenticationScheme(string name, string displayName, Type handlerType)
{
if (name == null)
{
@ -34,6 +35,7 @@ namespace Microsoft.AspNetCore.Authentication
Name = name;
HandlerType = handlerType;
DisplayName = displayName;
}
/// <summary>
@ -41,6 +43,11 @@ namespace Microsoft.AspNetCore.Authentication
/// </summary>
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>
/// The <see cref="IAuthenticationHandler"/> type that handles this scheme.
/// </summary>

View File

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