-
-
Notifications
You must be signed in to change notification settings - Fork 746
In-Process NuGet doesn't support authentication #2028
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
Comments
I did take a peak at those resources you linked and i also tried to reproduce the problem reliably. Its been a while now, so the details are somewhat hazy again, but i think i remember that i had to rely on #2014 to reproduce the issue. So i am not sure how to go forward with this. Easiest for me, would be to wait for #2014 to be merged and then take a look again. |
No worries! We’ll merge the PR targeting #2014 as soon as the .NET Core 2 PR is fixed and 0.26 is released. If you don’t have time or run into issues, I can fix this issue. Just wanted to avoid duplicate work if you already had a solution for this. |
I gladly pick this up again, once 0.26 is released. Can you summarize what the CredentialService needs to be able to do? And what, if any additional, tasks have to be completed along site the migration, apart from writing unit tests for the CredentialService? |
@Insire once #2085 is merged, you should be able to consume NuGet.Credentials package. Don't know how to hook it up. You'll probably need to read some source code here to see how to hook it up. |
@mholo65 allright, i'll probably take a look at this the coming weekend. Thanks for the pointers. |
so after investigating a little bit and starting a PR already, i am wondering what kind of workflows should I/we support? There is authentication via NuGet.config. Is there any other way, i might have missed or i should focus on? |
AFAIK, |
Not yet. I am still piecing things together. |
...and now I saw this #2090 😄 |
While i got your attention - how does the inprocess nuget client work? i was expecting to see nuget API calls, but all i found is processes being started via nuget.exe Edit: this is what i was able to find. |
Ok, after some digging, i conclude that the "in process client" still leverages the nuget.exe for interacting with the nuget API, its just that cake has functionality baked in for that, so one doesnt have to write cake tasks to restore packages and so on. |
The link you provided is for Regarding “restore packages and so on”. That are NuGet-aliases located in Cake.Common, and yes, they leverage
|
I still need to properly confirm this, but with using the latest version of cake (0.26.1) and moving the VSTS credential provider right next to the nuget exe and providing a NuGet.config next to them, i can properly access a private nuget feed when setting UseInProcessClient to true in the cake.config I might not have to do anything for this to work. |
@mholo65 so, the goal should be to obsolete the nuget.exe and access the nuget API directly? |
@Insire sorry for not getting back to this sooner.
Is this working for NuGet aliases only? E.g.
Yes, for pre-processor directives. ( |
@mholo65 the last addin is from a private VSTS nuget feed. I pulled the source for the nuget libraries from github to get an idea whats in there and how they do things and atleast for the credential stuff, it seemed fairly straight forward. They try to load assemblies that match a certain FileName pattern and map that to an interface. After that its just business as usual, as that interface provides a way to supply the required credentials. My current idea would be to search for a nuget config upwards the folder tree until i hit the root folder for the solution. Not sure yet how i would transform the name and password from the nuget config into something we can use yet. I'll take another look next weekend. My weeks are rather busy at the moment. |
How to handle authentication for the feeds configured in |
Right now, you can add authentication via nuget.config and if you want custom nuget credential providers (e.g. the one for VSTS). In the future, the goal is to move away from the nuget config (atleast for the in process client) and provide options to authenticate with cake only. If you got any ideas in that regard, i'm all ears. |
Is this about the popup window that lest you authenticate against DevOps (in my example) the same way Visual Studio does? |
@Insire @devlead I'm trying to pull a Cake Recipe package from a private feed in GitHub Packages. I have a <packageSourceCredentials>
<GitHub>
<add key="Username" value="%GITHUB_USER%" />
<add key="ClearTextPassword" value="%GITHUB_TOKEN%" />
</GitHub>
</packageSourceCredentials> This works in NuGet, but does not seem to work in Cake. I'm guessing perhaps the variable replacement is not happening in the Cake In-Process NuGet execution, but I don't know how to tell. Diagnostic logging doesn't give any information beyond this:
I can confirm the proper environment variables are set on the build runner. I tried Can you confirm if this is indeed a supported scenario in Cake the way it is in NuGet? |
I just hard-coded some temporary credentials in my Any idea if that could be implemented easily? |
Actually, it appears I was mistaken. This looks to be an issue with GitHub itself. The reason it worked for me above is because I used a personal access token to test with. Running on the CI build runner, it was using a different token, and was failing (as metioned in the thread I linked). When I use a PAT, regardless of environment, the substitution appears to be taking place in Cake. So scratch my posts, they're unrelated after all. :) |
Uh oh!
There was an error while loading. Please reload this page.
In-Process NuGet don't support authentication. It should support obtaining credentials just like
nuget.exe
Hints:
https://github.com/NuGet/NuGet.Client/tree/dev/src/NuGet.Clients/NuGet.Credentials
https://www.nuget.org/packages/NuGet.Credentials/
The text was updated successfully, but these errors were encountered: