-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
area-authIncludes: Authn, Authz, OAuth, OIDC, BearerIncludes: Authn, Authz, OAuth, OIDC, Bearer
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
Sometimes there are simple requires that can be achieved by overriding HandleAuthenticateAsync on JwtBearerHandler.
But getting all functionality is not possible because AddJwtBearer cannot be replicated because it uses a JwtBearerConfigureOptionsthat isinternal`.
Tu use it, I've been replacing the JwtBearerHandler registration:
services
.AddAuthentication()
.AddJwtBearer(authenticationScheme)
;
// Replace JwtBearerHandler with MyTokenHandler
services.RemoveAll<JwtBearerHandler>();
services.AddTransient<JwtBearerHandler, MyTokenHandler>();Because it's registered with services.AddTransient instead of services.TryAddTransient.
Describe the solution you'd like
services
.AddAuthentication()
.AddJwtBearer<MyTokenHandler>(authenticationScheme)
;Additional context
Or just use services.TryAddTransient to register JwtBearerHandler.
BrendanRidenour
Metadata
Metadata
Assignees
Labels
area-authIncludes: Authn, Authz, OAuth, OIDC, BearerIncludes: Authn, Authz, OAuth, OIDC, Bearer