From 7157b41000919adb9a6524b79ad26b17e0f92111 Mon Sep 17 00:00:00 2001 From: bicijinlian Date: Sun, 11 Jun 2023 11:17:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(Authentication.Browser)=20=EF=BC=9A?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3BrowserAuthenticationOptions=20=E5=9F=BA?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BrowserAuthenticationExtensions.cs | 11 ++--------- .../BrowserAuthenticationOptions.cs | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/AuthStudy.Authentication.Browser/BrowserAuthenticationExtensions.cs b/AuthStudy.Authentication.Browser/BrowserAuthenticationExtensions.cs index f5ca336..18ba244 100644 --- a/AuthStudy.Authentication.Browser/BrowserAuthenticationExtensions.cs +++ b/AuthStudy.Authentication.Browser/BrowserAuthenticationExtensions.cs @@ -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(); diff --git a/AuthStudy.Authentication.Browser/BrowserAuthenticationOptions.cs b/AuthStudy.Authentication.Browser/BrowserAuthenticationOptions.cs index 2a9f618..66f8937 100644 --- a/AuthStudy.Authentication.Browser/BrowserAuthenticationOptions.cs +++ b/AuthStudy.Authentication.Browser/BrowserAuthenticationOptions.cs @@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Authentication; namespace AuthStudy.Authentication.Browser { - public class BrowserAuthenticationOptions : AuthenticationOptions + public class BrowserAuthenticationOptions : AuthenticationSchemeOptions { /// /// 允许的浏览器