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

Make sure there's a logger present for each Credentials Request call #2223

Merged
merged 2 commits into from
May 21, 2018

Conversation

nkolev92
Copy link
Member

@nkolev92 nkolev92 commented May 9, 2018

Bug

Fixes: NuGet/Home#6762
Regression: No
If Regression then when did it last work:
If Regression then how are we preventing it in future:

Fix

Details: The fix here is rather simple but the impact is considerable.
We don't have a logger available every time a plugin is created.
We also have different types of loggers etc.
It's near impossible to solve the logging problem on a generic level, so I'll just address this use case here.

Basically, simply by making sure that a plugin has a logger each time before it calls GetRequestCredentials.
That way the plugin is allowed to log between the time it receives the request and it sends the response.
This is how device flow auth will work for dotnet.exe

I will work on adding this extra behavior in the spec.

Testing/Validation

Tests Added: No
Reason for not adding tests: Difficult to add automated tests for this. Tested extensively manually, by simulating a device flow auth with the test plugin:
nkolev92/NuGet.Tools@0b9cbdb
Validation done: ^^

//cc @jeffkl

@@ -91,6 +91,7 @@ public SecurePluginCredentialProvider(IPluginManager pluginManager, PluginDiscov

if (_isAnAuthenticationPlugin)
{
AddOrUpdateLogger(plugin.Plugin, _logger);
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this being passed as a function param to a private function if it's a class member?

Copy link
Member Author

Choose a reason for hiding this comment

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

good point, updated it.

@nkolev92
Copy link
Member Author

//cc @rohit21agrawal @jainaashish

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.

2 participants