servicestack - ServiceStack IdentityServer4 - IdentityServerAuthFeature
问题描述
我想将 IdentityServer 与我的 ServiceStack API 一起使用,但是,当我以这种方法在 Startup.cs 中添加它时:public override void Configure(Container)
Plugins.Add(new IdentityServerAuthFeature
{
AuthProviderType = IdentityServerAuthProviderType.UserAuthProvider,
AuthRealm = "XXX",
ClientId = "YYY",
ClientSecret = "ZZZ"
});
当我用我的类 \ 方法包装[Authenticate]
并尝试访问它时,我得到了这个响应:
{ "responseStatus": { "errorCode": "Exception", "message": "没有找到与 IdentityServer 提供者匹配的注册身份验证提供者" } }
我错过了什么吗?
这是此IdentityServerAuthFeature的实际实现
编辑 - 解决方案
经过一些调试后,问题出在HostConfig
. 我忘记添加了WebHostUrl
,我发现当我稍后查看元数据 ( ?debug=requestinfo
) 时,错误是:
ConfigurationException appHost.Config.WebHostUrl 必须设置为使用 Identity Server User Login >plugin,以便服务可以将其完整的http://url:port发送到 >Identity Server User Login
解决方案
推荐阅读
- python-3.x - 如何修复“无法在内部使用几何管理器网格。已经有由包管理的奴隶'
- excel - 如何在 Excel 中创建一个 IF 函数来汇总特定时间之间显示的客人数量?
- javascript - 这个绑定在哪里,es6 和 es5 ECMAScript 定义与那些有什么区别?
- html - 如何从电子应用程序中的 [mat-icon] 按钮中删除工具提示?
- reactjs - 如何修复在反应中返回 NaN 的事件处理程序中的调用索引?
- javascript - React/Webpack/Django - 未捕获的类型错误:无法读取未定义的属性“XXX”
- android-studio-3.3 - 断点在 Android Studio 3.3 中不起作用
- java - 将 3 个不同数组的所有值转换为它们的绝对值并返回所有 3 个的方法只保持第一个数组而不是接下来的两个
- python - 如何确保 vscode-python 正确显示来自 `flake8-rst-docstrings` 和/或 `flake8-black` flake8 扩展的 linter 条目?
- php - 为什么清理字符串功能不会阻止在评论字段中提交html链接