using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Authentication; namespace AuthStudy.Authentication.Basic { public static class BasicAuthenticationExtensions { public static AuthenticationBuilder AddBasic(this AuthenticationBuilder builder) { return builder.AddBasic(BasicAuthenticationDefaults.AuthenticationScheme); } public static AuthenticationBuilder AddBasic(this AuthenticationBuilder builder, string authenticationScheme) { return builder.AddBasic(authenticationScheme, configureOptions: null); } public static AuthenticationBuilder AddBasic(this AuthenticationBuilder builder, Action<BasicAuthenticationOptions> configureOptions) { return builder.AddBasic(BasicAuthenticationDefaults.AuthenticationScheme, configureOptions); } public static AuthenticationBuilder AddBasic(this AuthenticationBuilder builder, string authenticationScheme, Action<BasicAuthenticationOptions>? configureOptions) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } return builder.AddScheme<BasicAuthenticationOptions, BasicAuthenticationHandler>(authenticationScheme, configureOptions); } } }