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

Support basic authentication #1

Closed
xavierdecoster opened this Issue Apr 4, 2014 · 13 comments

Comments

Projects
None yet
8 participants
@xavierdecoster

xavierdecoster commented Apr 4, 2014

Steps performed:

  • Created a private myget feed which hosts private chocolatey packages
  • Add-PackageSource -Name initech -Location https://www.myget.org/F/initech-chocolatey -Trust -Provider Chocolatey
  • Install-Package -Source initech

Exception:
No Package Found
2014-04-04_1156

Expected:
prompt for credentials (basic auth: username/pwd)

Alternatively:
since chocolatey provider is using nuget under the hood, storing nuget credentials in nuget.config could be taken into account (tried, doesn't work)

@fearthecowboy fearthecowboy added the bug label Apr 18, 2014

@fearthecowboy

This comment has been minimized.

Show comment
Hide comment
@fearthecowboy

fearthecowboy Apr 18, 2014

Contributor

There are two issues

  • lack of credential support.
  • lack of additional metadata fields for sources.
Contributor

fearthecowboy commented Apr 18, 2014

There are two issues

  • lack of credential support.
  • lack of additional metadata fields for sources.
@nlowe

This comment has been minimized.

Show comment
Hide comment
@nlowe

nlowe Jul 15, 2015

Are there still plans to implement this? I cannot add authenticated package sources, they fail saying that the Web URI is invalid. This is incorrect (the endpoint is actually returning a 401).

nlowe commented Jul 15, 2015

Are there still plans to implement this? I cannot add authenticated package sources, they fail saying that the Web URI is invalid. This is incorrect (the endpoint is actually returning a 401).

@jianyunt jianyunt added the New Feature label Jan 7, 2016

@jianyunt jianyunt added this to the 1606 milestone Jan 7, 2016

@jianyunt jianyunt removed the bug label Jan 7, 2016

@Stijnc

This comment has been minimized.

Show comment
Hide comment
@Stijnc

Stijnc Mar 16, 2016

Any word on when milestone 1606 will be reached?
With Visual Studio Team services (former VSO) now offering a private nuget feed we could benefit from credential support in oneget.

Stijnc commented Mar 16, 2016

Any word on when milestone 1606 will be reached?
With Visual Studio Team services (former VSO) now offering a private nuget feed we could benefit from credential support in oneget.

@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Mar 16, 2016

Contributor

We will publish a new version of the Nugetprovider with -credential support in a week or so. Stay turned.

Contributor

jianyunt commented Mar 16, 2016

We will publish a new version of the Nugetprovider with -credential support in a week or so. Stay turned.

@quoctruong

This comment has been minimized.

Show comment
Hide comment
@quoctruong

quoctruong Mar 23, 2016

@Stijnc The latest version of NuGetProvider is now available. You can install it with Install-PackageProvider NuGet -Force.

After installing the latest NuGetProvider, you can try Find-Package with -Credential parameter.

quoctruong commented Mar 23, 2016

@Stijnc The latest version of NuGetProvider is now available. You can install it with Install-PackageProvider NuGet -Force.

After installing the latest NuGetProvider, you can try Find-Package with -Credential parameter.

@Stijnc

This comment has been minimized.

Show comment
Hide comment
@Stijnc

Stijnc Mar 24, 2016

@quoctruong works like a charm.

PS C:\WINDOWS\system32> Find-Package -Source testvs -Credential (get-credential)

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential

Name                           Version          Source                         Summary
----                           -------          ------                         -------
fiddler                        2.4.9.9          testvs

I only had an issue registering the my package source.

PS C:\WINDOWS\system32> Register-PackageSource -Location $Uri -Name 'AuthPackageSource' -ProviderName Nuget -Force -Tru
sted
Register-PackageSource : MSG:SourceLocationNotValid
«https:/*****.pkgs.visualstudio.com/DefaultCollection/_packaging/**********/nuget/v3/index.json»
At line:1 char:1

using nuget to register the source on the other hand worked as expected and I could use the find-package cmdlet as expected using a credential

Stijnc commented Mar 24, 2016

@quoctruong works like a charm.

PS C:\WINDOWS\system32> Find-Package -Source testvs -Credential (get-credential)

cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential

Name                           Version          Source                         Summary
----                           -------          ------                         -------
fiddler                        2.4.9.9          testvs

I only had an issue registering the my package source.

PS C:\WINDOWS\system32> Register-PackageSource -Location $Uri -Name 'AuthPackageSource' -ProviderName Nuget -Force -Tru
sted
Register-PackageSource : MSG:SourceLocationNotValid
«https:/*****.pkgs.visualstudio.com/DefaultCollection/_packaging/**********/nuget/v3/index.json»
At line:1 char:1

using nuget to register the source on the other hand worked as expected and I could use the find-package cmdlet as expected using a credential

@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Mar 24, 2016

Contributor

@Stijnc, thanks for validating it. Regarding register-packagesource, we discussed within our team whether we should support it. True, the nuget supports it. It saves your encrypted cred in the config. We think it may or maynot be a good idea to save user's cred. So we decided to not support it by now. If this is a common user scenario, please let us know. We can consider it. thanks!

Contributor

jianyunt commented Mar 24, 2016

@Stijnc, thanks for validating it. Regarding register-packagesource, we discussed within our team whether we should support it. True, the nuget supports it. It saves your encrypted cred in the config. We think it may or maynot be a good idea to save user's cred. So we decided to not support it by now. If this is a common user scenario, please let us know. We can consider it. thanks!

@Stijnc

This comment has been minimized.

Show comment
Hide comment
@Stijnc

Stijnc Mar 25, 2016

@jianyunt @quoctruong well, to test the credential support in Find-package I registered the source using nuget without specifying any credentials.
the register-packagesource throws an error registering the source, which is a bit odd.
I now need to register the source using nuget and only afterwards I can use find-package with credential support.
Below the extract:

  1. successful registration using nuget (without saving credentials)
  2. removing the source registration using nuget
  3. failed registration using Register-PackageSource
PS C:\> nuget sources add -name "powershelldev" -source https://*****.pkgs.visualstudio.com/DefaultCollection/_packa
ging/******/nuget/v2
Package Source with Name: powershelldev added successfully.
PS C:\> nuget sources remove -Name powershelldev
Package source with Name: powershelldev removed successfully.
PS C:\> Register-PackageSource -Name 'powershelldev' -Location 'https://******.pkgs.visualstudio.com/DefaultCollectio
n/_packaging/*******/nuget/v2' -ProviderName NuGet
Register-PackageSource : MSG:SourceLocationNotValid
«https://*****.pkgs.visualstudio.com/DefaultCollection/_packaging/********/nuget/v2»
At line:1 char:1
+ Register-PackageSource -Name 'powershelldev' -Location 'https://****** ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (powershelldev:String) [Register-PackageSource], Exception
    + FullyQualifiedErrorId : SourceLocationNotValid,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSo
   urce

Stijnc commented Mar 25, 2016

@jianyunt @quoctruong well, to test the credential support in Find-package I registered the source using nuget without specifying any credentials.
the register-packagesource throws an error registering the source, which is a bit odd.
I now need to register the source using nuget and only afterwards I can use find-package with credential support.
Below the extract:

  1. successful registration using nuget (without saving credentials)
  2. removing the source registration using nuget
  3. failed registration using Register-PackageSource
PS C:\> nuget sources add -name "powershelldev" -source https://*****.pkgs.visualstudio.com/DefaultCollection/_packa
ging/******/nuget/v2
Package Source with Name: powershelldev added successfully.
PS C:\> nuget sources remove -Name powershelldev
Package source with Name: powershelldev removed successfully.
PS C:\> Register-PackageSource -Name 'powershelldev' -Location 'https://******.pkgs.visualstudio.com/DefaultCollectio
n/_packaging/*******/nuget/v2' -ProviderName NuGet
Register-PackageSource : MSG:SourceLocationNotValid
«https://*****.pkgs.visualstudio.com/DefaultCollection/_packaging/********/nuget/v2»
At line:1 char:1
+ Register-PackageSource -Name 'powershelldev' -Location 'https://****** ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (powershelldev:String) [Register-PackageSource], Exception
    + FullyQualifiedErrorId : SourceLocationNotValid,Microsoft.PowerShell.PackageManagement.Cmdlets.RegisterPackageSo
   urce
@slimracing

This comment has been minimized.

Show comment
Hide comment
@slimracing

slimracing Jun 23, 2016

I am having a similar issue with PSGet and an authenticated feed. Find|Install-Module does not seem to pick up the NuGet config which works for chocolatey and the 401 returned from the feed results in a warning: 'Unable to resolve package source'.

Is this a new issue or will it be addressed when this is resolved?

slimracing commented Jun 23, 2016

I am having a similar issue with PSGet and an authenticated feed. Find|Install-Module does not seem to pick up the NuGet config which works for chocolatey and the 401 returned from the feed results in a warning: 'Unable to resolve package source'.

Is this a new issue or will it be addressed when this is resolved?

@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Jun 23, 2016

Contributor

Correct. I think NuGet provider does not read the cred from nuget.config.
Instead we added -credential support in the cmlets find-module/package, install-module/package recently. So you can do

Find-Module -Name xjea -Credential (get-credential)

The change will be in the next release of Windows or WMF.

Contributor

jianyunt commented Jun 23, 2016

Correct. I think NuGet provider does not read the cred from nuget.config.
Instead we added -credential support in the cmlets find-module/package, install-module/package recently. So you can do

Find-Module -Name xjea -Credential (get-credential)

The change will be in the next release of Windows or WMF.

@MichaelStankiewicz

This comment has been minimized.

Show comment
Hide comment
@MichaelStankiewicz

MichaelStankiewicz Jun 30, 2016

Whenever I use register-packagesource or register-psrepository in a DSC resource, I get an exception stating that the url isn't valid. However if I run the same code in my user context, it works fine. Is there any support coming for a system wide package source registration?

MichaelStankiewicz commented Jun 30, 2016

Whenever I use register-packagesource or register-psrepository in a DSC resource, I get an exception stating that the url isn't valid. However if I run the same code in my user context, it works fine. Is there any support coming for a system wide package source registration?

@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Aug 15, 2016

Contributor

@MichaelStankiewicz, the Auth and Proxy are supported in WMF 5.1

In WMF 5.1, OneGet supports finding and installing packages from a repository that requires basic authentication. You can supply your credentials to the Find-Package and Install-Package cmdlets. For example:

Find-Package -Source <SourceWithCredential> -Credential (Get-Credential)

Support for using OneGet behind a proxy

In WMF 5.1, OneGet now takes new proxy parameters: -ProxyCredential and -Proxy. Using these parameters, you can specify the proxy URL and credentials to OneGet cmdlets. By default, system proxy settings are used. For example:

Find-Package -Source http://www.nuget.org/api/v2/ -Proxy http://www.myproxyserver.com -ProxyCredential (Get-Credential)
Contributor

jianyunt commented Aug 15, 2016

@MichaelStankiewicz, the Auth and Proxy are supported in WMF 5.1

In WMF 5.1, OneGet supports finding and installing packages from a repository that requires basic authentication. You can supply your credentials to the Find-Package and Install-Package cmdlets. For example:

Find-Package -Source <SourceWithCredential> -Credential (Get-Credential)

Support for using OneGet behind a proxy

In WMF 5.1, OneGet now takes new proxy parameters: -ProxyCredential and -Proxy. Using these parameters, you can specify the proxy URL and credentials to OneGet cmdlets. By default, system proxy settings are used. For example:

Find-Package -Source http://www.nuget.org/api/v2/ -Proxy http://www.myproxyserver.com -ProxyCredential (Get-Credential)
@jianyunt

This comment has been minimized.

Show comment
Hide comment
@jianyunt

jianyunt Nov 3, 2016

Contributor

Supported in WMF 5.1 or Windows Server 2016 or Win10 Anniversary.

Contributor

jianyunt commented Nov 3, 2016

Supported in WMF 5.1 or Windows Server 2016 or Win10 Anniversary.

@jianyunt jianyunt closed this Nov 3, 2016

@jianyunt jianyunt removed the New Feature label Nov 3, 2016

brywang-msft added a commit that referenced this issue Jan 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment