1
您好我有一个MVC的网站,我必须把它迁移到网络核心2.旧网站有饼干和Facebook验证配置是这样的:MVC净芯2迁移认证
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
LoginPath = "LoginPath",
CookieName = "CookieName",
CookieDomain = "CookieDomain",
CookieSecure = CookieSecureOption.SameAsRequest,
Provider = new CookieAuthenticationProvider
{
OnApplyRedirect = ctx =>
{
//Some logic and redirection
}
}
});
app.UseFacebookAuthentication(new FacebookAuthenticationOptions
{
CallbackPath = "CallbackPath",,
AppId = "AppId",
AppSecret = "AppSecret",
Provider = new FacebookAuthenticationProvider
{
OnApplyRedirect = (context) =>
{
//Some logic and redirection
},
OnAuthenticated = (context) =>
{
//Some logic and add claim
}
}
});
现在我有:
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(
options =>
{
options.LoginPath = "LoginPath";
options.CookieName = "CookieName";
options.CookieDomain = "CookieDomain";
})
.AddFacebook(options =>
{
CallbackPath = "CallbackPath";
AppId = "AppId";
AppSecret = "AppSecret";
});
但我不能找到“提供者”把我有OnApplyRedirect和OnAuthenticated传统逻辑。我应该在哪里放置这个逻辑?