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

Credentials for multiple hosts. #4206

Closed
wants to merge 1 commit into from

Conversation

fa7ca7
Copy link
Contributor

@fa7ca7 fa7ca7 commented Jun 22, 2017

Now cargo login stores a token per host.
If the host parameter is omitted cargo stores a token as default, i.e. as a token for crates.io.

Resolves #3365.
Implemented based on the conversation in #3978.
This RP could be postponed until the cargo team decides which format for registry we should use. Currently, it's a URL.

Now `cargo login` stores a token per host.
If the host parameter is omitted cargo stores a token as default, i.e.
as a token for crates.io.
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexcrichton
Copy link
Member

This seems related to #4208 where the choice of url here is not the best today (e.g. the index everywhere) but rather we should find a better identifier for this. In that sense this may not be able to land for awhile unfortunately :(

@fa7ca7
Copy link
Contributor Author

fa7ca7 commented Jun 24, 2017

Let me know when I can update this PR accordingly to a new identifier.

@bors
Copy link
Contributor

bors commented Aug 25, 2017

☔ The latest upstream changes (presumably #4433) made this pull request unmergeable. Please resolve the merge conflicts.

@jan-hudec
Copy link

It would also occasionally be useful to read .cargo/credentials from current directory or it's parents the same way as .cargo/config is searched. For example if I had projects for two different customers (or work and private), I might use two different GitHub accounts to keep them separate. And then I might have /home/me/customer1/.cargo/config and /home/me/customer2/.cargo/config. But it appears not to be currently possible to have corresponding .cargo/credentials.

Also, note that (at least unless I am misunderstanding the code), the set of places where config and credentials are searched is actually disjoint. Say I have the project (on Windows this is rather common) in d:\projects\name. The cargo will look for config in d:\projects\name\.cargo\config, d:\projects\.cargo\config and d:\.cargo\config, but as far as I can tell, not c:\Users\me\.cargo\config. But it will only look for credentials in c:\Users\me\.cargo\credentials. Is this split really desired?

@fa7ca7
Copy link
Contributor Author

fa7ca7 commented Sep 14, 2017

This split is really desired. $CARGO_HOME/credentials file is global and should handle all cargo related credentials.

@jan-hudec
Copy link

Normally it should. That still does not explain why it must.

@carols10cents
Copy link
Member

This PR is kind of stale at this point and needs further changes as discussed, so I'm going to close it. Please open a new PR for updated changes! Thank you!

bors added a commit that referenced this pull request Nov 1, 2017
Support login tokens for multiple registries

This pull request builds on #4206 to support login using the the registry from alternate registries (RFC 2141). This includes the following changes:

 - allow credentials to be stored based on the registry
 - allow passing the registry to run cargo commands against using --registry

Note that this does not include a feature gate on the use of --registry as the publish code blocks publish if we use any features. @alexcrichton, are you happy with this approach, or is there a way that you would recommend this should be relaxed for testing purposes?
@bors
Copy link
Contributor

bors commented Aug 19, 2018

☔ The latest upstream changes (presumably #5907) made this pull request unmergeable. Please resolve the merge conflicts.

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.

6 participants