Skip to content

Update all built-in AuthenticationSchemeOptions to initialize Events #62595

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

halter73
Copy link
Member

@halter73 halter73 commented Jul 8, 2025

I'm not exactly sure why Events isn't always initialized to a non-null value especially given that the type is mark. It is in a bunch of other AuthenticationSchemeOptions like CookieAuthenticationOptions, OpenIdConnectOptions, BearerTokenOptions, etc. Changing it now for existing options type could theoretically break people who already used something like options.Events ??= new .... although I imagine most code would either omit the ?? part or only initialize to the default Events type.

Maybe the idea during the initial design of these types was that more people would derive from the Events type and set the Events property to their custom type during the initial design, but I don't think I've ever seen that outside of our tests.

Fixes #43313

@github-actions github-actions bot added the area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer label Jul 8, 2025
@halter73 halter73 requested review from glennc and MackinnonBuck July 8, 2025 01:46
@halter73 halter73 marked this pull request as ready for review July 8, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-auth Includes: Authn, Authz, OAuth, OIDC, Bearer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JwtBearerEvents might be null, despite being marked as not null
1 participant