Closed
Description
Following changes to be made to the authentication and authorization configuration APIs and behaviors:
- [ ] Change the WebApplicationBuilder.Authentication
property to be a method AddAuthentication()
with the same overloads as IServiceCollection.AddAuthentication()
- [ ] Add WebApplicationBuilder.AddAuthorization()
method that is functional equivalent of IServiceCollection.AddAuthorizationBuilder()
- Remove
Authentication
property from WebApplicationBuilder - Remove binding of
AuthenticationOptions.DefaultScheme
from configuration (anddotnet user-jwts
setting it in applicationSettings.Development.json) - When there is only a single AuthN scheme added, set
AuthenticationOptions.DefaultPolicy
to that scheme, and add a newbool
propertyAuthenticationOptions.DisableAutoDefaultScheme
to enable disabling this behavior - Auto-add AuthN and AuthZ middleware if any AuthN scheme is added in
all hosts (not justWebApplicationBuilder
)WebApplicationBuilder
and add newbool
optionto the various hosting options/APIsto enable disabling this behavior, e.g.WebApplicationOptions.DisableAutoAddAuthMiddleware
This behavior should apply whether adding AuthN schemes viaIServiceCollection.AddAuthentication()
orWebApplicationBuilder.AddAuthentication()
, etc.