-
Notifications
You must be signed in to change notification settings - Fork 599
DisplayName in new AuthN Plumbing? #1319
Comments
Security/src/Microsoft.AspNetCore.Authentication/AuthenticationServiceCollectionExtensions.cs Line 50 in df325de
@HaoK is this exposed anywhere else? E.g. I don't see a way to change it for Google, OIDC, etc.. |
It's set here to match the scheme name: https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.OpenIdConnect/OpenIdConnectExtensions.cs#L23 |
Yeah we don't have those overloads in the security layer right now, so you'd have to drop down and use the lower overload to tweak the display name |
If you decide to fix that in 2.0 (and I personally hope you will), please also fix aspnet/IISIntegration#391 (I'm fine submitting a PR if you prefer). |
Doubt we are doing that now, since its a non breaking change in 2.1 You can probably workaround this via directly tweaking the DisplayName via AuthenticationOptions.SchemeMap:
|
That's ridiculous. |
Well, it automatically means waiting maybe 5 or 6 months more before moving to 2.x. |
What are you trying to do with display name that is so critical? Check if its null? |
So you can just write your own filtering for which handlers to display for the external schemes, you don't have to use DisplayName != null as your condition. Why don't you just merge the list you have with the Windows scheme? |
You are able to inspect the schemes yourself via IAuthenticationSchemeProvider, just compute the display list using that directly... |
Its up to the app to decide which schemes are appropriate anyways, we wrote some sugar (that I think lives in Identity?) that filters the schemes using DisplayName != null, but its just sugar |
Sure, why not reinventing the wheel and using a hardcoded display name in your views when you could simply rely on |
Well, you can just wait til 2.1 as you said if you prefer that instead of using the workaround |
@HaoK maybe I wasn't clear enough: you CAN'T use the workaround you suggested with the host handlers due to the way you've decided to register them (in the IIS middleware constructor... dynamically |
The sugar is not meant to the final arbiter of what schemes should be displayed, that is template sugar for the Individual auth template basically. I never liked having that in the framework, but it is what it is. External clearly doesn't hosts as written either. |
The workaround for your case is to not use GetExternalAuthenticationSchemesAsync and compute that list yourself. |
Again, all that method does is:
You really don't gain very much by calling it :p |
Okay so @leastprivilege was right. Arguing so hard for a zero-risk change that will take 10 minutes to do is truly ridiculous. |
That's not the problem. The problem is that you can't use |
Doesn't matter how long the fix takes, bar is higher than this bug, shipstoppers only. |
Updating the display name associated with the host handlers was possible in 1.x. Since it's no longer possible in 2.x, that's a regression. Does that qualify as a shipstopper? services.Configure<IISOptions>(options =>
{
options.AuthenticationDescriptions.Clear();
options.AuthenticationDescriptions.Add(new AuthenticationDescription
{
AuthenticationScheme = IISDefaults.Negotiate,
DisplayName = "Intranet"
});
options.AutomaticAuthentication = false;
}); |
Most apps do not have a dynamic list of schemes, most have a couple of schemes they want to show, it really doesn't seem the end of the world for them to either:
|
If there was no way for you to workaround this in your app, you'd have a stronger argument :) |
Then you should strongly consider revisiting how you handle that in 2.x/3.x because even if you don't like it, setting the display name in the options and using But okay, point taken. I'll send a PR against the release branch as suggested by @Tratcher and try to bribe the guy in charge of approving the late PRs... |
Yeah this is a case of sugar overload in my mind. Those 2 lines should have just lived in the app, I tried to get rid of the concept entirely of DisplayName, but we couldn't come up with anything better, and we just ran out of time to spend on it so we brought it back late in preview 2 for the templates |
How do I set it? It's gone from the options class.
The text was updated successfully, but these errors were encountered: