简体   繁体   English

向身份服务器添加自定义声明4 GrantValidationResult

[英]adding custom claims to identity server 4 GrantValidationResult

As per http://docs.identityserver.io/en/release/reference/grant_validation_result.html I'm trying to add extra claims to a GrantValidationResult but the extra claims arent showing up just wondering where i could be going wrong here: 根据http://docs.identityserver.io/zh-CN/release/reference/grant_validation_result.html,我正在尝试向GrantValidationResult添加其他声明,但是这些额外声明并未显示出来,只是想知道我在哪里可能出错了:

var extraClaims = new List<Claim> {
new Claim("resource_id", resourceId) 
};
context.Result = new GrantValidationResult(
subject: bobIdentity,
authenticationMethod: "custom", 
claims: extraClaims); 
return;

If you haven't setup your own custom Extension Grant check out this information: 如果您尚未设置自己的自定义扩展授权,请查看以下信息:

http://docs.identityserver.io/en/release/topics/extension_grants.html?highlight=GrantValidationResult http://docs.identityserver.io/en/release/topics/extension_grants.html?highlight=GrantValidationResult

You need to create custom IExtensionGrantValidator implementation to add extra claims. 您需要创建自定义IExtensionGrantValidator实现以添加其他声明。

Simple example is also located at that link. 该链接上也有一个简单的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM