-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Hello there! Thanks for creating this library. Question about:
TokenExchange/src/Rsk.TokenExchange.IdentityServer4/TokenExchangeExtensionGrantValidator.cs
Line 90 in b999e77
| context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, "Unable to parse subject claim - IdentityServer requires subject claim for extension grants"); |
I understand from the error message (and my own digging) that IdentityServer4 indeed makes it difficult to create a custom GrantValidationResult for a subject- less token. Its pipeline for attaching claims to tokens is primarily aimed at (human) users -- principals with a subject claim. The IProfileService, and the configured claims for scopes/resources, are only invoked for token requests with a subject.
By design, IdentityServer4 does not emit a subject claim for tokens issued via the client credentials grant. So out of the box, this library cannot exchange tokens that are issued from that flow.
Question: Is there any particular reason for this limitation -- i.e. some security reason why it wouldn't make sense to exchange "client" tokens in the same manner as "user" tokens? Would you accept a PR to add support for "client" token exchange?