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

Adds login/logout commands #8

Merged
merged 20 commits into from
Sep 27, 2023
Merged

Conversation

travishathaway
Copy link
Collaborator

Fixes: #2

@travishathaway travishathaway marked this pull request as ready for review August 30, 2023 20:46
@jezdez jezdez self-assigned this Aug 30, 2023
@jezdez jezdez self-requested a review August 30, 2023 21:02
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.

Noice! I love where this is going <3

conda_auth/handlers/base.py Outdated Show resolved Hide resolved
conda_auth/handlers/base.py Outdated Show resolved Hide resolved
conda_auth/handlers/base.py Outdated Show resolved Hide resolved
conda_auth/handlers/basic_auth.py Outdated Show resolved Hide resolved
conda_auth/handlers/basic_auth.py Outdated Show resolved Hide resolved
conda_auth/handlers/basic_auth.py Outdated Show resolved Hide resolved
conda_auth/handlers/basic_auth.py Outdated Show resolved Hide resolved
conda_auth/handlers/basic_auth.py Outdated Show resolved Hide resolved
conda_auth/hooks.py Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
@travishathaway
Copy link
Collaborator Author

@jezdez,

After a discussion with @kenodegard yesterday, we decided against the decorator pattern for the class methods. This would put too much burden on the subclass authors to remember to always put those there. Instead we now simply run them inside the base class' authenticate method.

@kenodegard,

I attempted to solely rely on lru_cache like you had mentioned for caching secrets. The problem I ran into is passing a dictionary is not allowed (i.e. the settings value). Because of that, I decided to stick with my initial method for caching but improving it so that it is easier for subclass writers.

Part of that was changing how secret retrieval works. There is now an abstract _fetch_secret method that must be defined, which is invoked by the fetch_method on the base class. The base class method handles the caching logic so that the child classes do not have to.

The API has now been improved so that fetching a secret for a channel is simpler. There is now get_secret method which accepts a channel_name parameter and attempts to find and return a value from its cache.

@travishathaway
Copy link
Collaborator Author

@kenodegard and @jezdez,

I believe this is ready for another round of review. On top of making the refactor changes requested, I have also rearranged the command namespace. conda login has become conda auth login and conda logout has become conda auth logout.

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.

Loving where this is going, only smaller API questions!

conda_auth/cli.py Outdated Show resolved Hide resolved
conda_auth/handlers/base.py Outdated Show resolved Hide resolved
conda_auth/hooks.py Outdated Show resolved Hide resolved
conda_auth/hooks.py Outdated Show resolved Hide resolved
@travishathaway travishathaway merged commit 6ebe2ed into main Sep 27, 2023
4 checks passed
@kenodegard kenodegard deleted the add-login-logout-commands branch September 27, 2023 15:31
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.

Create login/logout commands
4 participants