feat!: new api key system#3636
Conversation
nicolaskempf57
left a comment
There was a problem hiding this comment.
Thanks for this PR ! I think we are ready on udata side, but it will require some changes in cdata and maybe other projects like front-kit if they also have an interface for the api key
Done in datagouv/cdata#962 |
maudetes
left a comment
There was a problem hiding this comment.
🎉 I think it will be a very nice improvement for security and usability !
| @me.route("/tokens/", endpoint="my_tokens") | ||
| class TokenListAPI(API): |
There was a problem hiding this comment.
Can we use the wording api key instead of vague token?
In my understanding, other potential token usage would have distinct routes anyway?
There was a problem hiding this comment.
I used api_token instead of just token. As discussed I prefer to keep one code for all the tokens since it's the same technical thing with the same operations on it.
# Conflicts: # udata/core/user/models.py # udata/tests/api/test_me_api.py
| from udata.core.api_token.models import ApiToken | ||
|
|
||
| ApiToken.objects(user=self, revoked_at=None).update( | ||
| set__revoked_at=datetime.now(timezone.utc) | ||
| ) |
There was a problem hiding this comment.
Should we delete api keys in the case of a user deletion?
There was a problem hiding this comment.
I think revoking is safer to not loose the keys if the user is restored?
There was a problem hiding this comment.
Hmm we don't have user restoration. They need to recreate an account if they want to come back
There was a problem hiding this comment.
I was thinking of a wrong deletion, for exemple Geoffrey miss click :-)
There was a problem hiding this comment.
ahah even if Geoffrey double-miss clicks, I would recommend recreating an account and contacting us, if needed, to get back any old dataset & co
ee48150 to
d2edafe
Compare
Following the merge of opendatateam/udata#3636 (just because it's faster to merge this than #962)
- Require opendatateam/udata#3636 <img width="2090" height="179" alt="image" src="https://github.com/user-attachments/assets/adb9240d-456f-4476-a0de-89fc4f620f17" /> <img width="1248" height="459" alt="image" src="https://github.com/user-attachments/assets/3ef4f09c-61da-4f53-a9bb-da422359115b" /> <img width="2095" height="329" alt="image" src="https://github.com/user-attachments/assets/2b943ad2-084a-402e-b4dd-0b8174c9b6cf" /> <img width="2092" height="418" alt="image" src="https://github.com/user-attachments/assets/8595708e-1c9f-40db-9e8f-200fe48260ec" /> <img width="902" height="325" alt="image" src="https://github.com/user-attachments/assets/2e872621-e0db-47ba-9de9-1fc5fbe9c3b2" />
Uh oh!
There was an error while loading. Please reload this page.