-
Notifications
You must be signed in to change notification settings - Fork 31
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
refactor: Authenticator refactoring (preparation for app token refreshing) #281
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TrishGillett
changed the title
Authenticator refactoring (preparation for app token refreshing)
refactor: Authenticator refactoring (preparation for app token refreshing)
Jul 30, 2024
TrishGillett
force-pushed
the
token-manager
branch
from
July 30, 2024 21:17
c9d6d8d
to
15891a4
Compare
for more information, see https://pre-commit.ci
TrishGillett
commented
Jul 30, 2024
TrishGillett
commented
Jul 30, 2024
TrishGillett
commented
Jul 30, 2024
TrishGillett
commented
Jul 30, 2024
Co-authored-by: Edgar Ramírez Mondragón <[email protected]>
for more information, see https://pre-commit.ci
Quality Gate passedIssues Measures |
edgarrmondragon
approved these changes
Jul 31, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @TrishGillett!
edgarrmondragon
pushed a commit
that referenced
this pull request
Aug 9, 2024
…the environment, part of refactoring in preparation for app token refreshing (#284) This PR continues the work started in #281, completing the major refactor. This is accomplished by creating PersonalTokenManager and AppTokenManager classes, moving logic to them, and adding tests. After this PR, I'll be able to easily implement refreshing for app tokens and other app token related features. In additional to the added unit tests, I have tested running an extractor on top of the proposed code, in a couple scenarios: with auth_token? | with additional_auth_tokens? | with personal tokens in env? | with app token? | # tokens that should be used | # tokens used in test run --|--|--|--|--|-- no | no | no | yes | 1 | 1 ✅ yes | yes (1) | no | yes | 3 | 3 ✅ no | yes (2) | no | yes | 3 | 3 ✅ I am not easily able to test the case of personal tokens being detected from the environment, just because changing the name of environment variables is not simple in my set up. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: In this PR I am not changing functionality but just refactoring to make functionality changes possible in a future PR. Essentially: make the change easy, then make the easy change.
My goal is to add github app token features, for example refreshing app tokens before they expire (they're only good for an hour and currently don't refresh), and allowing multiple app tokens
Currently, personal and app tokens are stored in the same list and treated interchangeably, so some structural changes are needed in order to handle them differently. My plan is to develop PersonalTokenManager and AppTokenManager classes so the code for working with each token type can be built into its manager class. In this PR I start by proposing to convert the TokenRateLimit class to a more general TokenManager, and I move functionality common to both token types there. I've added unit tests for the methods in TokenManager.
Follow up PRs will develop PersonalTokenManager and AppTokenManager and implement the new app token features.