Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add telemetry values to auth request and logout URIs, along with a sw… #531

Merged
merged 1 commit into from
Nov 30, 2016

Conversation

polita
Copy link
Contributor

@polita polita commented Nov 11, 2016

…itch to turn telemetry off

@brentschmaltz
Copy link
Member

There is some feedback from the community that OFF by default seems to be preferred.
aspnet/Security#1035 (I accidentally clicked +1 on the original issue opened by pinpointtownes)

@@ -165,15 +165,14 @@ public void GetSets()
OpenIdConnectMessage message = new OpenIdConnectMessage();
Type type = typeof(OpenIdConnectMessage);
PropertyInfo[] properties = type.GetProperties();
if (properties.Length != 47)
if (properties.Length != 48)
Assert.True(true, "Number of public fields has changed from 47 to: " + properties.Length + ", adjust tests");
Copy link

Choose a reason for hiding this comment

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

Change msg to 48 as well 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. Fixed.

@kevinchalet
Copy link
Contributor

I accidentally clicked +1 on the original issue opened by pinpointtownes

Are you sure it was accidental? :trollface:

@Eilon
Copy link

Eilon commented Nov 11, 2016

@brentschmaltz BTW you can un-thumbs-up by clicking the 👍 icon at the bottom of the issue again.

@brentschmaltz
Copy link
Member

@PinpointTownes :-) always a pleasure.

@polita polita added this to the Next 5.x Release milestone Nov 17, 2016
@polita polita force-pushed the polita/498Wilson5x branch from da53b3b to 78cca8c Compare November 17, 2016 18:25
@polita
Copy link
Contributor Author

polita commented Nov 28, 2016

@brentschmaltz Can you CR?

/// Gets or sets whether parameters for the library and version are sent on the query string for this <see cref="OpenIdConnectMessage"/> instance.
/// This value is set to the value of EnableTelemetryParametersByDefault at message creation time.
/// </summary>
public bool EnableTelemetryParameters
Copy link
Member

Choose a reason for hiding this comment

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

The only thing I can think of is if we did

{get;set;} = EnableTelemetryParametersByDefault;

would remove the need for a few sets in some methods.

Copy link
Member

Choose a reason for hiding this comment

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

@polita I don't see this in current PR. I was thinking this should be on the Property EnableTelemetryParameters

@kevinchalet
Copy link
Contributor

I don't wanna be evil, but note that thanks to the "lowest applicable version" policy used by NuGet, folks using the OIDC middleware won't get telemetry until a new OIDC package is released, unless they explicitly specify the latest IdentityModel version in their project.json 😄

... so maybe a static property is not necessary...? :trollface:

@polita
Copy link
Contributor Author

polita commented Nov 28, 2016

@PinpointTownes Yes, it's true that you'd have to explicitly download the new package. But since people might be pulling down a new package for other reasons than the awesome new telemetry feature, giving them a single line of code way to turn it off is still desirable.

At least, I thought for sure you'd be a proponent of that... :)

@polita polita force-pushed the polita/498Wilson5x branch from 78cca8c to 8e152ab Compare November 29, 2016 00:44
@polita
Copy link
Contributor Author

polita commented Nov 29, 2016

@brentschmaltz Thanks- updated the CR and squashed.

@polita polita force-pushed the polita/498Wilson5x branch from 8e152ab to e81ca05 Compare November 29, 2016 21:13
@polita
Copy link
Contributor Author

polita commented Nov 29, 2016

@brentschmaltz Updated with the change to use auto-property initializers.

/// <summary>
/// Gets or sets whether parameters for the library and version are sent on the query string for all instances of <see cref="OpenIdConnectMessage"/>.
/// </summary>
public static bool EnableTelemetryParametersByDefault = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, why not a property? 😮

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would a property getter/setter get you that this doesn't?

Copy link
Contributor

Choose a reason for hiding this comment

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

The immense satisfaction of respecting the best practices? :trollface:

Exposing public fields is generally discouraged (and I'm pretty sure there's even an FxCop rule for that)

Copy link
Contributor

Choose a reason for hiding this comment

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

Property implementations can be changed later without breaking callers. Fields can be changed to properties later but it requires recompiling the caller.

Copy link
Member

Choose a reason for hiding this comment

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

@Tratcher are you thinking something like, we set the property from an external source (config, etc)? Where the property could have some smarts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's the sort of future modification that may happen for an API like this. If it's a property then you can change it, but if it's a field you can't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to make it a property. Thanks for the feedback.

…itch to turn telemetry off

Update message in test

Update PR based on new design to include a static switch to easily turn off telemetry

Update the getter/setter syntax with CR feedback

Update with CR feedback on syntax

Update with CR feedback
@polita polita force-pushed the polita/498Wilson5x branch from e81ca05 to 7c8ab45 Compare November 30, 2016 00:36
@brentschmaltz
Copy link
Member

Well that was easy :-)
:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants