feat(Authentication.Browser) :修正BrowserAuthenticationOptions 基类

main
bicijinlian 2 years ago
parent aa092de9ac
commit 7157b41000

@ -25,7 +25,7 @@ namespace AuthStudy.Authentication.Browser
throw new ArgumentNullException(nameof(builder));
}
builder.AddService(Option.DefaultAuthenticateScheme, Option);
builder.AddService(Option);
builder.AddAuthentication(options =>
{
@ -43,16 +43,9 @@ namespace AuthStudy.Authentication.Browser
}
private static IServiceCollection AddService(this IServiceCollection builder, string defaultSchemeName, BrowserAuthenticationOptions option)
private static IServiceCollection AddService(this IServiceCollection builder, BrowserAuthenticationOptions option)
{
defaultSchemeName = defaultSchemeName ?? BrowserAuthenticationDefault.SchemeName;
BrowserAuthenticationOptions defaultOption = option ?? new();
defaultOption.DefaultScheme ??= defaultSchemeName;
defaultOption.DefaultAuthenticateScheme ??= defaultSchemeName;
defaultOption.DefaultChallengeScheme ??= defaultSchemeName;
defaultOption.DefaultForbidScheme ??= defaultSchemeName;
builder.AddSingleton(defaultOption);
builder.AddSingleton<BrowserAuthenticationHandler>();

@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Authentication;
namespace AuthStudy.Authentication.Browser
{
public class BrowserAuthenticationOptions : AuthenticationOptions
public class BrowserAuthenticationOptions : AuthenticationSchemeOptions
{
/// <summary>
/// 允许的浏览器

Loading…
Cancel
Save