0

我正在尝试配置我的 Duende(以前称为身份服务器 4)身份服务器以进行身份​​验证和授权。对于身份验证部分,我使用的是外部身份验证服务,因此得到的结果之一是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的一部分。

有什么办法可以添加吗?

先感谢您。

4

0 回答 0