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

Implement HTTP Basic Authentication #11

Merged
merged 6 commits into from
Oct 2, 2023
Merged

Conversation

travishathaway
Copy link
Collaborator

Fixes: #5

Additional information

This pull request attempts to make the user experience around logging in and out better. Before these changes, users were expected to manually edit and configure their .condarc files before logging in and out. I felt this was a cumbersome step and wanted to see what I could do to fix it.

The solution I came up with was giving the conda-auth plugin the ability to edit the .condarc file itself. The information that is written to the .condarc is then later used by normal conda commands.

For example, when a user logs in to a HTTP Basic Authentication channel with the following command:

conda auth login http://localhost --username user

The following information will be automatically saved to their .condarc file:

channel_settings:
- channel: http://localhost
  auth: http-basic
  username: user

The password is then saved using "keyring".

For future authentication types, we will then try our best to infer what type of authentication is being used so that we can avoid having to make users manually specify this.

Copy link
Member

@jezdez jezdez left a comment

Choose a reason for hiding this comment

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

Looks good!

@travishathaway
Copy link
Collaborator Author

The last thing I'd like to do for the pull request before taking it out of draft mode is adding more test coverage to the conda_auth.condarc module.

I'm also going to double check to make sure that there isn't anything buried in the "conda" API that would allow me to update the .condarc file. I'm pretty sure there isn't though.

@travishathaway travishathaway marked this pull request as ready for review September 29, 2023 10:20


@group.command("logout")
@click.argument("channel", callback=validate_channel)
def logout(channel):
@click.argument("channel", callback=parse_channel)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do channels ever have multiple/separate users? In that case, having a --username option here would be good (but I'm not sure if this is something that is necessary)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a fair question, and I thought about this too. We could support this, but I don't know how many people are actually doing this.

I would just leave it open as a possibility for something to implement in the future if requested.

@travishathaway travishathaway merged commit 761bce8 into main Oct 2, 2023
4 checks passed
@travishathaway travishathaway deleted the http-basic-auth branch October 2, 2023 16:49
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.

Add support for HTTP Basic Authentication
3 participants