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

(#1021) Authcred #1031

Closed
wants to merge 1 commit into from
Closed

(#1021) Authcred #1031

wants to merge 1 commit into from

Conversation

Apteryx0
Copy link

@Apteryx0 Apteryx0 commented Nov 1, 2016

This is a pretty simple change - the MS web APIs take a credential object. This change adds that cred object to the appropriate chocolatey helper functions and then passes it down to the MS web APIs.

Closes #1021

@Apteryx0 Apteryx0 changed the title Authcred (GH 1021) Authcred Nov 7, 2016
@ferventcoder ferventcoder self-requested a review January 21, 2017 18:20
.PARAMETER Credential
OPTIONAL - A System.Net.ICredentials object that contains credentials to
use to authenticate to the URL server. This is just ultimately passed
onto System.Net.HttpWebRequest Crentials property. Available in 0.9.11+
Copy link
Member

Choose a reason for hiding this comment

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

Will need to update version on all of these.

@@ -261,7 +267,7 @@ param(
if ($url.StartsWith('http:')) {
try {
$httpsUrl = $url.Replace("http://", "https://")
Get-WebHeaders -Url $httpsUrl -ErrorAction "Stop" | Out-Null
Get-WebHeaders -Url $httpsUrl -ErrorAction "Stop" -Credential $credential | Out-Null
Copy link
Member

Choose a reason for hiding this comment

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

Is it okay to pass a $null credential or will that error?

Copy link
Author

Choose a reason for hiding this comment

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

I think so (though I'm no powershell expert). Get-WebHeaders has a check for a $null cred (around line 71). Is that what you mean?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, fair!

Copy link
Author

Choose a reason for hiding this comment

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

This is still showing up in github as a requested change....

@@ -62,7 +68,10 @@ param(

$request = [System.Net.HttpWebRequest]::Create($url);
$defaultCreds = [System.Net.CredentialCache]::DefaultCredentials
if ($defaultCreds -ne $null) {
if ($credential -ne $null) {
Write-Host "Using credential."
Copy link
Member

Choose a reason for hiding this comment

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

This should be either Write-Verbose or Write-Debug. And it should provide more information. What credential? User passed or something default?

Copy link
Member

@ferventcoder ferventcoder left a comment

Choose a reason for hiding this comment

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

Looks mostly good, but there are a few questions I have there that need to be looked at, either by me or you.

@ferventcoder
Copy link
Member

What happened here?

@Apteryx0 Apteryx0 force-pushed the authcred branch 3 times, most recently from 03bd227 to 1f89144 Compare January 23, 2017 15:33
@Apteryx0
Copy link
Author

Sorry, I made a real mess of that. Hopefully I have reset everything back to what it should have been and fixed what you asked for.

@@ -53,6 +58,7 @@ Get-WebFile
param(
[parameter(Mandatory=$false, Position=0)][string] $url = '',
[parameter(Mandatory=$false, Position=1)][string] $userAgent = 'chocolatey command line',
[parameter(Mandatory=$false, Position=2)][Object] $credential = $null,
Copy link
Member

Choose a reason for hiding this comment

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

Remove position. Go for name only.

@ferventcoder
Copy link
Member

This will probably be added to Install-ChocolateyPowerShellCommand, Install-ChocolateyZipPackage, and Install-ChocolateyVsixPackage as well (and any others I may be forgetting).

Feel free to squash these commits into one single commit, then make that commit summary and body pretty good. 👍

@Apteryx0
Copy link
Author

As far as I am aware all requested changes have been made (unless I'm missing something....?) - not sure why this is still showing as "Changes requested"

@ferventcoder
Copy link
Member

@spitzbub only because I haven't been back here to review again. Notice the date of my request for changes. Don't worry, will be reviewing these over the next week.

@ferventcoder
Copy link
Member

This was reviewed for 0.10.4 but it didn't make it in. It was due to line endings changing on one file making it harder to review - the line endings change was necessary to ensure authenticode signing the scripts does not fail due to issues in PowerShell.

@ferventcoder
Copy link
Member

Also the don't merge master comment applies here.

@ferventcoder
Copy link
Member

You may also wish to fix the git username in your commits since you changed your username - otherwise it doesn't know how to apply contributor credit for your work.

I'm not sure on Authcred here - there is probably a better name that summarizes this feature.

Extends the variaboue helper APIs that call Get-ChocolateyWebFile to
take a authentication credential and then pass that credential to the
various web calls. This allows us to download resources from webservers
that require authentication. The credential eventually gets used in a
System.Net.HttpWebRequest object and thus can be either a
NetworkCredential or a CredentialCache object. The previous behaviour
was just to use the default credentials which is generally the windows
user credential, which is often unsuitable.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Russell Mora seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@gep13 gep13 changed the title (GH 1021) Authcred (#1021) Authcred Oct 15, 2021
@we-mi
Copy link

we-mi commented Sep 22, 2022

Is there any update on this?
We came across a situation where we need to pass credentials to Install-ChocolateyPackage (and other functions) and this seems to be exactly what we were looking for.
We're using a workaround right now, but this would be much easier to handle.

@pauby
Copy link
Member

pauby commented Sep 22, 2022

As the CLA hasn't been signed we can't pull this change in.

@we-mi
Copy link

we-mi commented Sep 23, 2022

As the CLA hasn't been signed we can't pull this change in.

Sadly, this hasn't been done for a few years now :/

Is there anything I can do to help with this topic? Would it be helpful if I create a new PR?

I'm tagging the original author of this PR in this comment. Maybe he can do something about this
@Apteryx0

@norbertstoll
Copy link

As the CLA hasn't been signed we can't pull this change in.

Sadly, this hasn't been done for a few years now :/

Is there anything I can do to help with this topic? Would it be helpful if I create a new PR?

I'm tagging the original author of this PR in this comment. Maybe he can do something about this @Apteryx0

We also need the ability to pass credentials and it seems like this will stuck forever if no one takes action.
Can someone please tell what to do next?

Kind regards

@pauby
Copy link
Member

pauby commented Jul 18, 2023

@norbertstoll @we-mi A new PR would be best at this stage to move this along.

To remove any misunderstanding about this specific PR I'm going to go and ahead and close it.

@pauby pauby closed this Jul 18, 2023
@norbertstoll
Copy link

As the CLA hasn't been signed we can't pull this change in.

Sadly, this hasn't been done for a few years now :/

Is there anything I can do to help with this topic? Would it be helpful if I create a new PR?

I'm tagging the original author of this PR in this comment. Maybe he can do something about this @Apteryx0

Hi @we-mi,

are you still interested in getting this fixed? It's obviously up to us, since @Apteryx0 didn't respond the your tagging.
I'm not that much into github until now and to be honest, I'd just try to copy the former PR and create a new one out of it.

Do you have any other suggestions on this?

Regards

@we-mi
Copy link

we-mi commented Jul 19, 2023

Hi @norbertstoll,

thanks for bringing this up again 👍

I'm totally interested in getting this fixed. You can expect a new PR in the next couple of days. I just need to read a bit more about how to create correct PRs in this repo :D

@norbertstoll
Copy link

Hi @we-mi,

you're welcome ;)

Let me know if I can assist at any point. I'm really looking forward to get this fixed/implemented.

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.

Auth cred for downloads
6 participants