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

Support https headers (to deploy to gitlab packaging) #111

Closed
chrisbetz opened this issue Mar 20, 2019 · 4 comments
Closed

Support https headers (to deploy to gitlab packaging) #111

chrisbetz opened this issue Mar 20, 2019 · 4 comments

Comments

@chrisbetz
Copy link

Hi,

I want to deploy things into a Gitlab hosted maven repository (see https://docs.gitlab.com/ee/user/project/packages/maven_repository.html#authenticating-to-the-gitlab-maven-repository).

For authentication, one needs to pass credentials as an http header, which is usually done via settings.xml in maven.

I'm not sure how to do this in leiningen / pomegranate. Maybe there's a way to add the config to the session (as it is basically passed down as aether.connector.http.headers configuration property), maybe there's a better way.

I'm willing to provide a PR for this, but I would first like your advice on how to tackle this in the best way (i.e., least offensive, easiest, ... you name it, way).

Or, maybe I'm just not getting it and pomegranate already supports it and I just missed it.

Any pointers are welcome. Thanks a lot.

Chris

@chrisbetz
Copy link
Author

Just stumbled over this gradle-related question and the documentation. Maybe the problem's even deeper...

@cemerick
Copy link
Collaborator

cemerick commented Apr 2, 2019

Wow, that approach to authentication is really quite unfortunate. Since Pomegranate has no access to the underlying HTTP abstractions, it's not so simple as adding support for HTTP headers, etc.

I'm not going to work on this, but I think your best bet will be to follow the pattern set by https://github.com/s3-wagon-private/s3-wagon-private, probably subclassing whatever the usual HTTPS wagon is. That will allow you to access the username/passphrase info set in the usual way via Leiningen, set the custom Gitlab headers as necessary, and otherwise let everything else work as it usually does.

FWIW, this approach will also mean that you can proceed independently; no changes here or in Leiningen should be necessary.

@chrisbetz
Copy link
Author

chrisbetz commented Apr 2, 2019 via email

@craigmalone
Copy link

Just for completeness, I had a similar need to access GitLab maven repositories from leiningen.

I followed the solution outlined above to create a small HttpWagon wrapper and works fine for accessing our GitLab private repos from lein.

If anyone needs this, it is available at:

https://github.com/nicheware/lein-gitlab-wagon

@slipset slipset closed this as completed Jan 10, 2020
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

No branches or pull requests

4 participants