-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Open
Labels
Needs: Attention πThis issue needs the attention of a contributor, typically because the OP has provided an update.This issue needs the attention of a contributor, typically because the OP has provided an update.area-authIncludes: Authn, Authz, OAuth, OIDC, BearerIncludes: Authn, Authz, OAuth, OIDC, Bearer
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 JwtBearerConfigureOptions
that is
internal`.
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
Needs: Attention πThis issue needs the attention of a contributor, typically because the OP has provided an update.This issue needs the attention of a contributor, typically because the OP has provided an update.area-authIncludes: Authn, Authz, OAuth, OIDC, BearerIncludes: Authn, Authz, OAuth, OIDC, Bearer