Skip to content
This repository was archived by the owner on Nov 1, 2018. It is now read-only.

Add back the DisplayName setting #400

Merged
merged 1 commit into from
Jul 13, 2017
Merged

Add back the DisplayName setting #400

merged 1 commit into from
Jul 13, 2017

Conversation

Tratcher
Copy link
Member

#391 @PinpointTownes @DamianEdwards

@Tratcher Tratcher added this to the 2.0.0 milestone Jul 13, 2017
@Tratcher Tratcher self-assigned this Jul 13, 2017
@Tratcher Tratcher requested a review from HaoK July 13, 2017 18:24
@@ -15,13 +17,14 @@ public void ConfigureServices(IServiceCollection services)
// These two middleware are registered via an IStartupFilter in UseIISIntegration but you can configure them here.
services.Configure<IISOptions>(options =>
{
options.AuthenticationDisplayName = "Windows Auth";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should just default this to the scheme like everything else to be consistent: IISDefaults.AuthenticationScheme. We don't suffix anything else with Auth today

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about that. Do you want the Windows scheme to be included by default in the "providers list"?

Pretty sure this has already been discussed in the past.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's null to avoid showing up by default. This is just the sample.

@kevinchalet
Copy link

@Tratcher thanks!

Did you consider directly exposing AuthenticationSchemeBuilder so you could also change the scheme name?

Something like:

public AuthenticationSchemeBuilder Scheme { get; } = new AuthenticationSchemeBuilder
{
    HandlerType = typeof(AuthenticationHandler),
    Name = IISDefaults.AuthenticationScheme
};
services.Configure<IISOptions>(options =>
{
    options.Scheme.DisplayName = "Intranet";
});

@HaoK
Copy link
Member

HaoK commented Jul 13, 2017

That seems more dangerous, I don't think we want to allow people to change the HandlerType at all

@Tratcher
Copy link
Member Author

That's interesting, bug I agree exposing the handler would be problematic.

@HaoK
Copy link
Member

HaoK commented Jul 13, 2017

I don't think making the scheme name configurable is that critical, but if we want to expose that as well, its harmless and matches what Security auth does

@kevinchalet
Copy link

Well, if that's your only concern, you still can add a check to ensure the type wasn't changed before calling Buid():

if (!typeof(AuthenticationHandler).IsAssignableFrom(_options.Scheme.HandlerType))
{
    throw new InvalidOperationException("You're doing something wrong, bro'.");
}

@HaoK
Copy link
Member

HaoK commented Jul 13, 2017

That just seems like a more error prone alternative to exposing only AuthenticationScheme / DisplayName

@Tratcher
Copy link
Member Author

The structure would be nice..

@kevinchalet
Copy link

Sure. But that was a clever way to save one property while adopting the same pattern as the one you've used for CookieBuilder... :trollface:

@HaoK
Copy link
Member

HaoK commented Jul 13, 2017

Yeah but unlike CookieBuilder, the Handler IS the main thing, so throwing when you set that defeats the whole purpose of exposing that.

@HaoK
Copy link
Member

HaoK commented Jul 13, 2017

I would go minimal, we can always add the builder later if things get more complicated.

@Tratcher Tratcher merged commit 5753784 into rel/2.0.0 Jul 13, 2017
@Tratcher Tratcher deleted the tratcher/display branch July 13, 2017 22:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants