如何为 ASP.NET 样板文件使用外部身份验证?
How to use External Authentication for ASP.NET Boilerplate?
我想为我的项目使用外部身份验证。谁能告诉我如何为 ASP.NET 样板文件使用外部身份验证?
上的文档
UserManager defines an extension point named 'external authentication source'. We can create a class derived from IExternalAuthenticationSource and register to the configuration. There is DefaultExternalAuthenticationSource class to simplify implementation of IExternalAuthenticationSource. Let's see an example:
public class MyExternalAuthSource : DefaultExternalAuthenticationSource<Tenant, User>
{
public override string Name => "MyCustomSource";
public override Task<bool> TryAuthenticateAsync(string userNameOrEmailAddress, string plainPassword, Tenant tenant)
{
// Authenticate user and return true or false
}
}
我想为我的项目使用外部身份验证。谁能告诉我如何为 ASP.NET 样板文件使用外部身份验证?
UserManager defines an extension point named 'external authentication source'. We can create a class derived from IExternalAuthenticationSource and register to the configuration. There is DefaultExternalAuthenticationSource class to simplify implementation of IExternalAuthenticationSource. Let's see an example:
public class MyExternalAuthSource : DefaultExternalAuthenticationSource<Tenant, User>
{
public override string Name => "MyCustomSource";
public override Task<bool> TryAuthenticateAsync(string userNameOrEmailAddress, string plainPassword, Tenant tenant)
{
// Authenticate user and return true or false
}
}