-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Labels
area-authIncludes: Authn, Authz, OAuth, OIDC, BearerIncludes: Authn, Authz, OAuth, OIDC, Bearernullable
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
The following code will throw a NullReferenceException:
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(o =>
{
o.Events.OnMessageReceived += (ctx) => Task.CompletedTask;
});
It will do so despite o.Events being flagged as not nullable.
Expected Behavior
o.Events is not null
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
6.0.400
Anything else?
/// <summary> | |
/// The object provided by the application to process events raised by the bearer authentication handler. | |
/// The application may implement the interface fully, or it may create an instance of JwtBearerEvents | |
/// and assign delegates only to the events it wants to process. | |
/// </summary> | |
public new JwtBearerEvents Events | |
{ | |
get { return (JwtBearerEvents)base.Events!; } | |
set { base.Events = value; } | |
} |
This should probably have JwtBearerEvents?
cfbao, stefanolsenn, CaringDev and Rookian
Metadata
Metadata
Assignees
Labels
area-authIncludes: Authn, Authz, OAuth, OIDC, BearerIncludes: Authn, Authz, OAuth, OIDC, Bearernullable