.net core 使用openiddict设置登录页面绝对url的SSO
我正在使用openiddict进行自定义sso,并希望在spa应用程序中的一个单独域上托管登录ui。我面临的问题是挑战行动的支撑配置 我试图覆盖OnRedirectToLogin事件,但显然不起作用.net core 使用openiddict设置登录页面绝对url的SSO,.net-core,identity,openiddict,.net Core,Identity,Openiddict,我正在使用openiddict进行自定义sso,并希望在spa应用程序中的一个单独域上托管登录ui。我面临的问题是挑战行动的支撑配置 我试图覆盖OnRedirectToLogin事件,但显然不起作用 services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options =>
{
options.Events = new CookieAuthenticationEvents()
{
OnRedirectToLogin = async (context) =>
{
context.HttpContext.Response.Redirect("https://example.com/account/login");
}
};
});
我做错smth了吗?在中找到了以下问题的解决方案 要添加的代码:
services.ConfigureApplicationCookie(options =>
{
options.Events.OnRedirectToLogin = context =>
{
context.HttpContext.Response.Redirect("http://example.com/login");
return Task.CompletedTask;
};
});