简体   繁体   中英

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:

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

You need to create custom IExtensionGrantValidator implementation to add extra claims.

Simple example is also located at that link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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