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

HttpGetter with Basic Auth + tests #34

Closed
wants to merge 1 commit into from
Closed

HttpGetter with Basic Auth + tests #34

wants to merge 1 commit into from

Conversation

adrianlop
Copy link

closes #32

@adrianlop
Copy link
Author

hi @mitchellh can you review please?
I tried this code using Nomad master branch (and overwriting the go-getter in vendor).
It pulled a .jar from a secured JFrog Artifactory and worked.

@adrianlop
Copy link
Author

btw, I can't reproduce the appveyor test errors (TestTarGzipDecompressor and TestZipDecompressor), all tests are passing in my dev env.
any hints please?

thanks!!

Copy link
Contributor

@catsby catsby left a comment

Choose a reason for hiding this comment

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

I have some nit picks and a request for documentation. The README needs to be updated so users know this is available, and can learn how to use it.

I assume we're only supporting the format https://url.com?username=username&password=***.

I've also seen https://username:[email protected], is that a supported format here? Should it be? (I honestly don't know if that's a valid format, or maybe it's discouraged)

@@ -115,6 +144,20 @@ func (g *HttpGetter) GetFile(dst string, u *url.URL) error {
return err
}

func (g *HttpGetter) parseUrl(u *url.URL) (basicAuthUser, basicAuthPass string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit pick - this method name is pretty generic/broad but the actual implementation is pretty narrow, we're specifically grabbing the username/password, so a more descriptive name would be better

Copy link
Author

Choose a reason for hiding this comment

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

changed to getHttpBasicAuth

@@ -115,6 +144,20 @@ func (g *HttpGetter) GetFile(dst string, u *url.URL) error {
return err
}

func (g *HttpGetter) parseUrl(u *url.URL) (basicAuthUser, basicAuthPass string) {
qUser := "http_basic_auth_user"
qPass := "http_basic_auth_pass"
Copy link
Contributor

@catsby catsby Sep 23, 2016

Choose a reason for hiding this comment

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

We need to document the format for users so that they know how to use this authentication.

Copy link
Author

Choose a reason for hiding this comment

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

added documentation in README.md

@adrianlop
Copy link
Author

@catsby thanks for reviewing!
I didn't add support for username:[email protected], it is discouraged and browsers like Chrome, Firefox, disabled support for this.

@adrianlop
Copy link
Author

@catsby ping! can you review it again please? I'd like to do a PR to Nomad if this gets merged. thanks!

@catsby
Copy link
Contributor

catsby commented Oct 4, 2016

I think the changes look good to me, thanks! I defer to @mitchellh to 👍 / 👎 the merge

@holtwilkins
Copy link

Hey @adrianlop / @catsby / @mitchellh , happy new year! Might it be possible to push this through so this functionality can make its way into the nomad artifact downloader?

@dadgar dadgar mentioned this pull request May 3, 2017
@dadgar dadgar closed this May 3, 2017
@dadgar
Copy link
Contributor

dadgar commented May 3, 2017

@adrianlop @holtwilkins So go-getter already supports this with normal basic auth formatting:
http://<user>:<password>@foo.com/bar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP Basic auth support?
4 participants