IdentityServer,如何使用多个权限验证令牌

时间:2018-01-15 07:58:57

标签: access-token identityserver4

如何使用IdentityServer.accesstokenvalidation包来验证使用多个权限的令牌?

在我的前端应用程序中,我正在使用以下内容获取令牌:

1- subdomain1.identityserver.com

2- subdomain2.identityserver.com

3- subdomain3.identityserver.com

现在,如果我使用subdomain1.identityserver.com获取令牌,那么令牌将如下所示:

{
  "nbf": ,
  "exp": ,
  "iss": "subdomain1.identityserver.com",
  "aud": [
    "subdomain1.identityserver.com/resources",
  ],
  "client_id": "Frontend",
  "sub": "",
  "auth_time": 1516002171,
  "idp": "local",
  "scope": [
    "openid",
    "profile",
  ],
  "amr": [
    "external"
  ]
}

在我的API中,我使用IdentityServer.accesstokenvalidation来验证这些令牌,如何告诉我的API使用颁发者(令牌中的iss)作为权限?

我尝试过类似的事情:

JwtSecurityTokenHandler.InboundClaimTypeMap = new Dictionary<string, string>();
        app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
        {
            Authority = variable,
            DelayLoadMetadata = true,
        });

如果Authority是变量,但看起来权限将在启动时注册一次。

0 个答案:

没有答案
相关问题