【问题标题】:After changing ApiName on IdentityServerAuthenticationOptions client still works with Identity Server 4在 IdentityServerAuthenticationOptions 客户端上更改 ApiName 后,仍然可以使用 Identity Server 4
【发布时间】:2017-01-21 16:00:34
【问题描述】:

我是 Identity Server 4 的新手,我正在关注官方 QuickStarts

该文档建议使用一些选项,以便了解所有这些是如何工作的。但是在我尝试了最后一个“进一步实验”之后,我遇到了麻烦。

当我像这样更改 API Startup.cs 文件上的 ApiName 时:

app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
    Authority = "http://localhost:5000",
    RequireHttpsMetadata = false,

    ApiName = "api2" //<-- this was api1
});

我仍在从客户端应用程序中获取结果(API 的 IdentityController 被执行并返回用户声明的 json 数据)。

阅读文档(也可能根据常见逻辑)我被引导相信,如果客户端应用程序获得与 API 所需的范围不同的范围(又名 ApiName),它应该无法访问控制器。

我对流程的理解有误还是什么?

【问题讨论】:

    标签: asp.net-identity .net-core identityserver4


    【解决方案1】:

    我对此也不确定,但我认为 ApiName 不是范围。如果你添加

    AllowedScopes = {"api2"} 到选项,然后你会得到“禁止”作为结果。

    Check this post

    【讨论】:

    猜你喜欢
    • 2020-06-13
    • 2018-12-04
    • 2019-07-25
    • 1970-01-01
    • 2020-03-22
    • 2020-01-11
    • 2021-08-07
    • 2019-06-06
    • 1970-01-01
    相关资源
    最近更新 更多