我正在尝试配置我的Duende (前称为identity server4)身份服务器以进行身份验证和授权。对于身份验证部分,我使用的是外部身份验证服务,其结果之一是UserID。然后,我想在我的访问令牌中添加这个UserID作为自定义声明。但是,我不知道这是怎么做到的。
具体来说,我想实现这样的东西:
// Client/program.cs
var client = new HttpClient();
var tokenResponse = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
{
Address = https://localhost:5001/connect/token,
ClientId = "1",
ClientSecret = "secret",
Scope = "api1",
UserID = UserID // here is the problem. It creates the correct access token without this line
});问题是UserID没有定义为RequestClientCredentialsTokenAsync的一部分。
有什么办法我可以加进去吗?
提前谢谢你。
发布于 2022-03-08 13:42:37
ClientCredentials Flow不涉及任何用户交互,因为在与用户相关的数据中不会有任何签名。
您可以使用使用用户名和密码进行身份验证的遗留ResourceOwnerPassword Flow。您的当前方法与服务器与服务器之间的交互有关。
https://stackoverflow.com/questions/71338037
复制相似问题