Skip to content

Add GitHub helper on Windows using WPF on netfx #40

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

Merged
merged 1 commit into from
May 20, 2019
Merged

Add GitHub helper on Windows using WPF on netfx #40

merged 1 commit into from
May 20, 2019

Conversation

mjcheetham
Copy link
Collaborator

Port the GitHub WPF-based UI from GCM Windows to GCM Core.

Fixes #36

@mjcheetham mjcheetham added enhancement New feature or request platform:windows Specific to the Windows platform host:github Specific to the GitHub host provider labels May 8, 2019
@mjcheetham mjcheetham requested a review from jrbriggs May 8, 2019 13:42
@mjcheetham
Copy link
Collaborator Author

The GitHub.UI project was originally a 'shared project' in GCM Windows which is no longer recommended or supported. Shared projects used to be basically a big sort of "#include" into other 'head' projects, meaning it didn't result in a new binary. Now GitHub.UI is its own real project and is producing an extra binary.

Should we fold these types into the main GitHub.Authentication.Helper project?

@mjcheetham
Copy link
Collaborator Author

/azp run GCM-PR

@azure-pipelines
Copy link

No commit pushedDate could be found for PR 40 in repo microsoft/Git-Credential-Manager-Core

@@ -19,7 +19,7 @@
<!-- Implicit SDK targets import (so we can override the default targets below) -->
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

<Target Name="CoreCompile" DependsOnTargets="GetBuildVersion">
<Target Name="CoreCompile" DependsOnTargets="GetBuildVersion" Condition="'$(OSPlatform)'=='osx'">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add an extra condition here to prevent this project from building on non-macOS systems.

This shouldn't be needed as the solution does not select this project for building except in Mac* configurations.. however VS Windows feels the need to try and build it anyway 😕 Ugh.


public TtyGitHubPromptAuthentication(ICommandContext context)
public async Task<ICredential> GetCredentialsAsync(Uri targetUri)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The logic here is now:

if helper exists
    exec helper
else
    exec terminal-prompt
endif

Copy link
Contributor

Choose a reason for hiding this comment

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

If we can't find a helper would it be because one doesn't match or because the exe is missing / in the wrong place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Or the platform doesn't have a helper (like macOS in this case)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As and when a Mac GitHub helper is available, they just need to drop the binary with that name, compliant with same the wire/cmdarg protocol as the Windows one and it'll start working.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For Windows I'll add a warning message if we cannot find it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added.


namespace Microsoft.Git.CredentialManager.Authentication
{
public abstract class AuthenticationBase
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Pulling out the shared bits between the Microsoft and GitHub auth components: specifically helper process invocation and EnsureTerminalPromptsEnabled.

@mjcheetham mjcheetham requested review from jeschu1 and jamill May 9, 2019 12:32
&& envarPrompts == "0")
string helperName = GitHubConstants.AuthHelperName;

if (PlatformUtils.IsWindows())
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if it would be easier to have constant GitHubConstants.AuthHelperName.Windows / GitHubConstants.AuthHelperName.NonWindows .
Food for thought.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did consider this, but then we'd still need this "if Windows then" check. Might as well just enforce the difference is only the ".exe" part rather than allowing a different name entirely.

@jeschu1
Copy link
Contributor

jeschu1 commented May 20, 2019

@mjcheetham, can you add some pictures of GUI for reference. I believe it should be very similar to the old.

@@ -0,0 +1,283 @@
<ResourceDictionary
Copy link
Contributor

Choose a reason for hiding this comment

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

@mjcheetham , can you confirm the wpf is mostly unchanged?
It looks that way from my quick glance comparison

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The WPF/XAML code is unchanged except for namespace and white space changes.

Add a Windows authentication helper for GitHub using WPF on .NET
Framework 4.6.1.
@jeschu1
Copy link
Contributor

jeschu1 commented May 20, 2019

The GitHub.UI project was originally a 'shared project' in GCM Windows which is no longer recommended or supported. Shared projects used to be basically a big sort of "#include" into other 'head' projects, meaning it didn't result in a new binary. Now GitHub.UI is its own real project and is producing an extra binary.

We can revisit this in the future if we need to. I don't think we should block on his now.

@mjcheetham
Copy link
Collaborator Author

@mjcheetham, can you add some pictures of GUI for reference. I believe it should be very similar to the old.

Here you go @jeschu1!

Username & password:

image

Auth code (app):

image

Auth code (SMS):

image

@mjcheetham mjcheetham merged commit 7570407 into git-ecosystem:master May 20, 2019
@mjcheetham mjcheetham deleted the github-winui branch May 20, 2019 15:39
mjcheetham added a commit that referenced this pull request May 20, 2019
Since #40 is complete, we now have UI for GitHub on
Windows.. updating the markdown current status table.

Also minor formatting change to the table, we now
centre the tick columns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request host:github Specific to the GitHub host provider platform:windows Specific to the Windows platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub UI prompt should be ported from GCM Windows
2 participants