Skip to content
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

Update JWT sample code for subscriptions #1171

Merged
merged 2 commits into from
Nov 21, 2024
Merged

Update JWT sample code for subscriptions #1171

merged 2 commits into from
Nov 21, 2024

Conversation

Shane32
Copy link
Member

@Shane32 Shane32 commented Nov 21, 2024

The previous sample handler decoded the parsed JWT token directly using JwtSecurityTokenHandler. This works fine when the TokenValidationParameters were all configured (including the security keys). However, when using OIDC, the TokenValidationParameters should be generated from the ConfigurationManager, as it needs to download the keys from the OIDC endpoint before the TokenValidationParameter instance contains the keys. The revised code now is a copy (without much of the event and error handling) of the JwtBearerHandler logic, so that validation will work similarly to however it is configured within ASP.NET Core. Events are still not implemented at this time.

Keep in mind that while this code can be used as a guide for to how to write authorization logic for subscriptions, it is the user's responsibility to ensure that their endpoint is secure. Perhaps in the future we may publish this code in a NuGet package, but for now it is still sample code.

@Shane32 Shane32 self-assigned this Nov 21, 2024
@Shane32 Shane32 merged commit a530f4b into master Nov 21, 2024
11 checks passed
@Shane32 Shane32 deleted the update_jwt branch November 21, 2024 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants