要使用多个 Owin Auth 提供程序,你可以按照以下步骤操作:
protected void Application_Start()
{
// 注册 Owin 中间件
ConfigureAuth(app);
}
public void ConfigureAuth(IAppBuilder app)
{
// 配置第一个 Auth 提供程序
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
// 配置选项
});
// 配置第二个 Auth 提供程序
app.UseSomeOtherAuthentication(new SomeOtherAuthenticationOptions
{
// 配置选项
});
// 还可以配置更多的 Auth 提供程序
}
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
// 配置选项
});
app.UseSomeOtherAuthentication(new SomeOtherAuthenticationOptions
{
// 配置选项
});
// 还可以配置更多的 Auth 提供程序
}
}
请注意,具体的配置选项取决于你使用的 Auth 提供程序。你需要根据实际情况修改代码示例中的配置选项。
希望这个解决方法对你有帮助!
上一篇:ASP.NET 4.7.2 - Docker - COPY 失败:CreateFile + 系统找不到指定的文件
下一篇:ASP.NET 4.7.2 OWIN JWT Bearer Authentication Bearer prefix(ASP.NET 4.7.2 OWIN JWT承载身份验证承载前缀)