aspnet / HttpAbstractions

[Archived] HTTP abstractions such as HttpRequest, HttpResponse, and HttpContext, as well as common web utilities. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
382 stars 193 forks source link

Added protected ctor to AuthenticationSchemeProvider #990

Closed khellang closed 6 years ago

khellang commented 6 years ago

Closes https://github.com/aspnet/Home/issues/2827

This will let me derive from AuthenticationSchemeProvider, pass in StringComparer.OrdinalIgnoreCase instead of the default StringComparer.Ordinal, and swap the implementation in the container.

It does not affect registration in any way (SchemeMap in AuthenticationOptions is still case-sensitive), but it will let me do scheme lookups without having to worry about the correct casing. I.e. github and GitHub will both return the correct scheme.

Personally, I'd prefer to take it one step further by adding a SchemeNameComparer option to AuthenticationOptions (as shown in this branch). That would allow me to skip the custom class altogether and just set the property on the options object.

What do you think? Too crazy? 😄

// @HaoK @davidfowl @Eilon @Tratcher

HaoK commented 6 years ago

Too crazy, we don't want to be responsible for making that work everywhere if someone turned this new switch on...

khellang commented 6 years ago

Too crazy, we don't want to be responsible for making that work everywhere if someone turned this new switch on...

I'm assuming that was in response to my option proposal? I guess the ctor is a nice compromise 😄

HaoK commented 6 years ago

Yes, the idea is I'm fine making our implementations more extensible (for things like case-insensitivity), I'm not fine with trying to make case-insensitivity first class

HaoK commented 6 years ago

Thanks @khellang

khellang commented 6 years ago

Thank you! ❤