-
Notifications
You must be signed in to change notification settings - Fork 61
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
Add token based authentication feature #326
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #326 +/- ##
==========================================
- Coverage 36.97% 36.42% -0.56%
==========================================
Files 106 110 +4
Lines 4500 4774 +274
==========================================
+ Hits 1664 1739 +75
- Misses 2836 3035 +199 ☔ View full report in Codecov by Sentry. |
Thank you very much. 🎉 |
@m-kuhn My pleasure. I've made some changes to make specific tokens for plugin. Please find below the updated description for this PR. Changes Summary
Token Usage Guidelines
Please find below a GIF demonstrating this feature. |
Thanks for the update @Xpirix , this new screencast looks very promising! If I understand correctly, there is a timeout on the token of 15 days and the token needs to be refreshed? Additional ideas more "nice to have":
One example: https://help.transifex.com/en/articles/6248858-generating-an-api-token (even though this is linked to the user account like a personal access token rather than a resource specific token as here). Other similar examples would be "github repository deploy key" with the difference that this key is not generated, but the rest is very much the same. I am also interested in opinions from @Gustry @Guts @3nids as qgis-plugin-ci contributors/maintainers |
One more thing
as a plugin maintainer I would like to see all tokens that are associated with a plugin I am responsible for, even if they were generated by others in the team. I think it's nice to show who created a token but a token should be completely detached from a user account after creation. I.e. if a someone leaves the development team, the token should be kept active, so any CI/CD pipelines continue to work and others in the team should then still be able to revoke this token. |
Thank you for the feedback @m-kuhn .
Yes, that makes sense. I will make every token available for a very long duration. They can always be revoked anytime.
Thanks for theses ideas, I'm going to implement them.
That's well noted.
From what I understand from the basic process of uploading/updating a plugin version, a user is always needed. Indeed, a token contains the plugin information but also the user identity (user_id) because the user don't have to log in when using it. If we don't store the user identity in the token, we won't be able to retreive which user is uploading a plugin and the process will raise an error. |
Please find bellow the description and a GIF of the latest changes according to the previous comments.
|
Thank you for these updates.
One question regarding this, if Anna creates a token for FancyPlugin and configures a release pipeline to use this token (e.g. stored in github action secrets). Later Anna leaves the dev team and removed permissions to upload new versions. If a new release is triggered via this pipeline, will the pipeline still work? |
@m-kuhn You're welcome.
I see. You're right; the pipeline will not work anymore because this Token contains the user information, and Anna doesn't have the permission anymore. To resolve this, I suggest editing the workflow when uploading a new version using a token:
This way, all created tokens will be independent from Anna, and the pipeline will continue to work even if Anna leaves the dev team and no longer has the permission. |
I like this. Alternative to the current term: " Token {token_description}"? But it's a tiny detail, only if it's reasonable effort. |
This feature has been deployed. Please feel free to check and share your feedback. Thanks. |
I think it's something like an ID for the token. But we can hide that since we implemented the Description column. |
Changes Summary
pyjwt
anddjangorestframework-simplejwt
in the requirements files./api/token/
) and refresh (/api/token/refresh/
) endpoints.Bearer the_access_token
is specified inHTTP_AUTHORIZATION
. The process involves:HTTP_AUTHORIZATION
starts withBearer
.Please find below a video demonstrating this feature in Postman. In this example, we specify the token in the GET request, and the cookies are set automatically. Thus, there's no need to specify the token in the POST request.
token_auth.mp4