This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
Standardize services.AddXyz() behavior with default config #1191
Closed
Description
Should AddXyz(o => o = { })
also register the default configuration binding? The complication is each auth can be called multiple times with the name overload, so one possible soln is to have an AddXyz that takes a name, and binds to the named section.
Examples:
services.AddCookies(); // binds to section: Microsoft.AspNetCore.AspNetCore.Authentication:Cookies
services.AddCookies("Application"); // binds to Microsoft.AspNetCore.AspNetCore.Authentication:Application
services.AddOAuth("Github"); // binds to Microsoft.AspNetCore.AspNetCore.Authentication:Github
// Auth generalizes to
services.AddXyzAuthentication() // binds to "Microsoft.AspNetCore.AspNetCore.Authentication:<Xyz>"
services.AddXyzAuthentication(schemeName) // binds to "Microsoft.AspNetCore.AspNetCore.Authentication:<schemeName>"
// Frameworks:
services.AddIdentity(); => binds to config.GetSection("Microsoft.AspNetCore.Identity")
// Generalize to:
services.AddXyz(); => binds XyzOptions to config.GetSection("Microsoft.AspNetCore.Xyz")
We also should add more support in the binder for things like PathString which cannot be bound today.
@glennc @ajcvickers @divega @DamianEdwards @davidfowl @Eilon @Tratcher