简体   繁体   English

点击 [Authorize] 总是重定向到 IdentityServer4 中的 /account/login

[英]Hitting [Authorize] always redirects to /account/login in IdentityServer4

If I hit an endpoint that has the [Authorize] attribute, I get redirected to /Account/Login?returnUrl=XXX .如果我点击具有[Authorize]属性的端点,我会被重定向到/Account/Login?returnUrl=XXX

Is there a way to change this behavior?有没有办法改变这种行为? I've already changed LoginUrl in IdentityServerOptions.UserInteraction to something else.我已经将IdentityServerOptions.UserInteraction LoginUrl更改为其他内容。

我们可以通过在CookieAuthenticationOptions设置LoginPath来改变这CookieAuthenticationOptions ,虽然接受的参数是PathString ,这意味着如果你想将用户重定向到另一个网站,你必须使用选项中的一个事件,更具体地说 - CookieAuthenticationOptions.Events.RedirectToAccessDenied

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM