You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
namespace AuthStudy.Authentication.Browser
{
public static class BrowserAuthenticationExtensions
{
public static AuthenticationBuilder AddBrowser(this AuthenticationBuilder builder)
{
return builder.AddBrowser(BrowserAuthenticationDefault.SchemeName);
}
public static AuthenticationBuilder AddBrowser(this AuthenticationBuilder builder, string authenticationScheme)
{
return builder.AddBrowser(authenticationScheme, configureOptions: null);
}
public static AuthenticationBuilder AddBrowser(this AuthenticationBuilder builder, Action<BrowserAuthenticationOptions> configureOptions)
{
return builder.AddBrowser(BrowserAuthenticationDefault.SchemeName, configureOptions);
}
public static AuthenticationBuilder AddBrowser
(
this AuthenticationBuilder builder,
string authenticationScheme,
Action<BrowserAuthenticationOptions> configureOptions
)
{
if (builder == null)
{
throw new ArgumentNullException(nameof(builder));
}
return builder;
//return builder.AddScheme<BrowserAuthenticationOptions, BrowserAuthenticationHandler<BrowserAuthenticationOptions>>(authenticationScheme, "", configureOptions);
}
}
}