首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为令牌生成添加自定义声明- Duende标识服务器

为令牌生成添加自定义声明- Duende标识服务器
EN

Stack Overflow用户
提问于 2022-03-03 13:30:11
回答 1查看 600关注 0票数 0

我正在尝试配置我的Duende (前称为identity server4)身份服务器以进行身份验证和授权。对于身份验证部分,我使用的是外部身份验证服务,其结果之一是UserID。然后,我想在我的访问令牌中添加这个UserID作为自定义声明。但是,我不知道这是怎么做到的。

具体来说,我想实现这样的东西:

代码语言:javascript
复制
// 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的一部分。

有什么办法我可以加进去吗?

提前谢谢你。

EN

回答 1

Stack Overflow用户

发布于 2022-03-08 13:42:37

ClientCredentials Flow不涉及任何用户交互,因为在与用户相关的数据中不会有任何签名。

您可以使用使用用户名和密码进行身份验证的遗留ResourceOwnerPassword Flow。您的当前方法与服务器与服务器之间的交互有关。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71338037

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档