响应中的访问令牌包含以下声明:
"alg": "RS256",
"kid": "143e829c2b57489969753ba4f8205979df0da988c640cffa5f1f4eda1b6e6aa4",
"typ": "JWT"
"nbf": 1481451903,
"exp": 1481455503,
"iss": "https://localhost:44350",
"aud": [ "https://localhost:44350/resources", "customAPI" ],
"client_id": "oauthClient",
"scope": [ "customAPI.read" ]
这是配置告诉我的应用程序使用IdentityServer进行身份验证
app.UseIdentityServerAuthentication(
new IdentityServerAuthenticationOptions
{
Authority = "https://localhost:44350/",
ApiName = "customAPI",
ApiSecret = "secret",
AllowedScopes = {"customAPI.full_access", "customAPI.read_only" },
RequireHttpsMetadata = false
});
如何允许用户在Identity https://localhost:44350/之外的IdentityServer的不同别名上进行身份验证,例如:http://192.168.1.20:44350/?
目前,来自后一个域的令牌获取在我的客户端上被视为无效,该客户端将权限设置为前一个域。
答案 0 :(得分:6)
在ConfigureServices
方法中添加IdentityServer时,可以设置静态颁发者名称。这是传递给AddIdentityServer
的选项。
https://identityserver4.readthedocs.io/en/release/reference/options.html