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.

48 lines
1.3 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 class BrowserAuthenticationOptions : AuthenticationSchemeOptions
{
/// <summary>
/// 是否启用浏览器认证
/// </summary>
public bool Enable { get; set; } = true;
/// <summary>
/// 允许的浏览器
/// </summary>
public List<string> AllowBrowsers { get; set; } = new List<string>();
/// <summary>
/// 允许移动设备
/// </summary>
public bool AllowMobile { get; set; } = true;
/// <summary>
/// 允许爬虫
/// </summary>
public bool AllowSpider { get; set; }
public BrowserAuthenticationOptions() :
this(true, new List<string>() { "Chrome", "Firfox", "Edge" }, true, true)
{
}
public BrowserAuthenticationOptions(bool enable, List<string> allowedBrowsers, bool allowedMMobile, bool allowedSpider)
{
Enable = enable;
AllowBrowsers = allowedBrowsers;
AllowMobile = allowedMMobile;
AllowSpider = allowedSpider;
}
}
}