c# - 如何覆盖 Identity Server 4 中的默认错误路径?

标签 c# asp.net-core identityserver4

我有一个 Identity Server 4 实现,我正在将 UI 从 ASP.NET MVC 迁移到一个解耦的 React 应用程序。我遇到的问题是,当 Identity Server 处理错误(例如无效的客户端)时,它会重定向到 /home/error?errorId=<error-id>我假设使用路径 defined in a constant here .我想自定义此错误路径,使其与我的 React 应用程序中的路由相匹配。知道如何做到这一点吗?我找到的最接近答案的是 here on Github OP 询问是否有计划使这些常量可定制,Brock Allen 回答"is"!那是2016年😁

最佳答案

AddIdentityServer 过载您可以使用它来配置 IdentityServerOptions 被 IdentityServer 使用。这是设置 ErrorUrl 的示例属性(property):

services.AddIdentityServer(options =>
{
    options.UserInteraction.ErrorUrl = "/path/to/error";
})

关于c# - 如何覆盖 Identity Server 4 中的默认错误路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58624571/

相关文章:

c# - C#中私有(private)类的概念

c# - 获取当前工作的ip地址

c# - ASP.NET Core 3 API 忽略带有 Bearertoken 的授权属性

asp.net-core - IdentityServer4:从 Azure AD 获取访问 token

c# - 导出数据表时如何去除export to excel警告

Controller 和 View 之外的 ASP.NET 5 依赖注入(inject)

c# - 由于 appsettings.json 的路径,添加迁移无法从文件 appsettings.json 读取连接字符串

c# - IdentityServer4 和 Azure AD 在登录页面上自动选择用户

c# - 与遗留系统(Forms Auth、ADFS、AD)集成的身份服务器(OAuth2)实现

c# - 为什么要用blank get;放; C# 中的访问器?