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 VisualStudioCodeCredential #10979

Merged
merged 10 commits into from
Apr 3, 2020

Conversation

AlexanderSher
Copy link
Contributor

No description provided.

@schaabs schaabs requested a review from pakrym April 1, 2020 22:27
{
internal static class StaticCachesUtilities
{
private static readonly Lazy<Action> s_clearStaticMetadataProvider = new Lazy<Action>(() =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is compiling to expressions here worth it?

public void Dispose() => WindowsNativeMethods.CredDelete(_target, WindowsNativeMethods.CRED_TYPE.GENERIC);
}

private sealed class OsxRefreshTokenFixture : IDisposable
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


public VisualStudioCodeCredentialLiveTests(bool isAsync) : base(isAsync)
{
Matcher.ExcludeHeaders.Add("Content-Length");
Copy link
Contributor

Choose a reason for hiding this comment

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

For curiosity sake why are we excluding content length?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IdentityRecordedTestSanitizer changes request body, so computed "Content-Length" will be incorrect.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@schaabs , should we change it?

Copy link
Contributor

Choose a reason for hiding this comment

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

In theory it should just work, can you debug and see why that codepaths is not getting hit?

Copy link
Member

Choose a reason for hiding this comment

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

The identity tests have their own sanitizer, and it should update Content-Length as well.

entry.Request.Body = Encoding.UTF8.GetBytes("Sanitized");
UpdateSanitizedContentLength(entry.Request.Headers, 0, entry.Request.Body.Length);

If we can't figure out why we still need to omit this from the matcher let's not block merging this. Just file an issue to investigate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error looks like this:

Header differences:
    <Content-Length> values differ, request <181>, record <9>

So it is playback Content-Length that isn't sanitized.

Copy link
Contributor

@pakrym pakrym left a comment

Choose a reason for hiding this comment

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

Pending comments

@pakrym
Copy link
Contributor

pakrym commented Apr 3, 2020

Great job adding test coverage to this not-so-easy-to-cover feature 👍

- On Linux, disable tests that require Libsecret
{
internal sealed class LinuxVisualStudioCodeAdapter : IVisualStudioCodeAdapter
{
private static readonly string s_userSettingsJsonPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Code", "User", "settings.json");
Copy link
Member

Choose a reason for hiding this comment

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

Seem like settings on Linux is under $HOME/.config/Code/User/settings.json.

See https://vscode.readthedocs.io/en/latest/getstarted/settings/

@AlexanderSher AlexanderSher deleted the VscCredentials2 branch August 24, 2020 21:04
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.

4 participants