-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should JsonWebTokenHandler take SecurityTokenDescriptor.Subject into account? #1193
Comments
@PinpointTownes |
Good to know. Maybe an Now, the real question is the one I asked here: #1194. If |
@PinpointTownes @mafurman Do you seem any harm in using SecurityTokenDescriptor.Subject to add values in JsonWebTokenHandler.CreateToken(SecurityTokenDescriptor ...)? Other than the 'dup' issue and what 'set' takes precedent. We originally had the API CreateToken(JObject, SigningCredentials, EncryptingCredentials), which seemed natural. Our position in the stack forced us to remove references to external libraries for the 3.0 release. We see value in staying 'break free' moving forward. The breaks from 4.x -> 5.x were hard to manage. So, we removed that API and added Claims to SecurityTokenDescriptor as the properties provide a way to set common values. An option is to add the API CreateToken(IDictionary<string, object>, SigningCredentials, EncryptingCredentials), but this forces one to add common claims into the dictionary. Moving forward, we may benefit from letting the user decide if the 'ClaimsIdentity' should be created when validating, since some users won't need it. |
@PinpointTownes What do you think about |
@PinpointTownes any comment? |
It's certainly an option, but I wonder if it wouldn't be worth supporting both (with the Is there a particular reason not to support that? |
@PinpointTownes I was thinking it would be more deterministic and easier to debug. I'm open to either, with a bias to what users want. |
Personally, I'd prefer supporting both, as I'll keep using |
@PinpointTownes ok, so the ClaimsIdentity is first, any items in the dictionary will override. That would allow a base set of claims and to act as an instance. |
Thanks! |
For some reasons, it seems that the new
JsonWebTokenHandler
no longer honors theClaim
claims stored inSecurityTokenDescriptor.Subject
. Instead, you have to populate theClaims
property (anIDictionary<string, object>
).Is it the intended behavior?
The text was updated successfully, but these errors were encountered: