Skip to content

Added an option to the publish window to use Credentials. - #256

Merged
clairernovotny merged 6 commits into
NuGetPackageExplorer:masterfrom
ironicnet:master
Dec 18, 2017
Merged

clairernovotny merged 6 commits into
NuGetPackageExplorer:masterfrom
ironicnet:master

Conversation

@ironicnet

Copy link
Copy Markdown
Contributor

Added an option to the publish window so we can choose to send the request with the default credentials or setting the Personal Access Token in the credential.

I think that this fixes #58 . Although I think that the sources should have a way to identify which kind of authentication to use.

I don't know if i broke any coding / design guideline as I didn't see any guide for contributing. I just followed some code.
Also, didn't find any unit test or test project to add tests to it.
Tested it against our VSTS and worked well.
Preview of the window:
image

}
}

private void UsePAT_ToolTipOpening(object sender, System.Windows.Controls.ToolTipEventArgs e)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What is the use of this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

None at all. Probably i misclicked something on the designer and generated this handler.

Will fix that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Pushed the file with the removed code. Thanks for the head up!

if (_useApiKey != value)
{
_useApiKey = value;
OnPropertyChanged("UseApiKey");

@304NotModified 304NotModified Nov 29, 2017 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@onovotny we can already use nameof isn't?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nameof can be used, it's a compiler feature.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not familiar with the nameof keyword. I'll look into it and implement it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@304NotModified 304NotModified left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🎉 thanks! looks good! Added some small notes!

Unfortunately I don't know how to test this. Is there some environment we could test this?

private bool? _publishAsUnlisted = true;
private bool? _appendV2ApiToUrl = true;
private bool? _useApiKey = true;
private bool? _unlistPreviousVersions = false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why do we need this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We don't. I started working on another issue when I found the vsts bug. That _unlistPreviousVersions shouldn't be there.

I'll remove it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

Content="API Key"
ToolTip="Use this when only an API Key is required"
/>
<RadioButton x:Name="UsePAT"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I prefer to use the term "AccessToken" instead of PAT as we also have "UseAccessToken"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll update that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the VSTS UI uses "Personal access token"
image

@ironicnet ironicnet Nov 30, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

One thing that i noticed is that i'm using VSTS as a reference.
VSTS doesn't require a username, just the Personal Access Token as a password in the credentials.
Right now i'm sending "PAT" in the username.
Maybe we should let the user specify actual credentials? Just in case, we are limiting the scope for VSTS and missing others.

Something along this lines:
image

(I have this change ready)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe we should let the user specify actual credentials? Just in case, we are limiting the scope for VSTS and missing others.

that is indeed better :)

@304NotModified 304NotModified added this to the 6.0 milestone Nov 29, 2017
@ironicnet

Copy link
Copy Markdown
Contributor Author

@ironicnet

Copy link
Copy Markdown
Contributor Author

Modified the publish window as @304NotModified suggested.

Now you can add credentials to the push

@BerendWouters

BerendWouters commented Nov 30, 2017 •

Copy link
Copy Markdown

But how does this new implementation allow you to use a PAT?

@ironicnet

Copy link
Copy Markdown
Contributor Author

Just as the nuget console. You write the Pat in the password field, and writing anything in the username

https://docs.microsoft.com/es-es/vsts/package/nuget/nuget-exe#add-a-feed-to-nuget-2
So instead of doing this:
nuget.exe sources add -name {your feed name} -source {your feed URL} -username {anything} -password {your PAT}
You do the same in the credentials fields.

@ironicnet ironicnet changed the title Added an option to the publish window to use a Personal Access Token. Added an option to the publish window to use Credentials. Dec 1, 2017
@304NotModified

Copy link
Copy Markdown
Collaborator

testing now

@304NotModified

Copy link
Copy Markdown
Collaborator

started, but blocked by #269 and #270.

Unfortunately out of time today. Will try to re-test this week

@304NotModified 304NotModified mentioned this pull request Dec 11, 2017
@clairernovotny

Copy link
Copy Markdown
Member

@ironicnet @304NotModified FYI, I did a rebase off of master, so you may need to do a hard reset or re-get this PR branch again.

@clairernovotny
clairernovotny merged commit 89e7334 into NuGetPackageExplorer:master Dec 18, 2017
@ironicnet

Copy link
Copy Markdown
Contributor Author

@304NotModified FYI, I did a rebase off of master, so you may need to do a hard reset or re-get this PR branch again.

Sorry but i'm not that experienced in Github GUI. This is something you need me to do? Or is something i should do in my branch to get it updated?

@clairernovotny

Copy link
Copy Markdown
Member

Nope, already merged in. The latest CI build appxbundle has it and it'll be in the next release.

This was referenced Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support publishing to servers that require authentication

4 participants