@@ -122,6 +122,33 @@ and the user that is attached to that token is removed from the project.
122
122
This is, if the user is removed while the build is running,
123
123
the builders won't be able to access the API.
124
124
125
+ Alternative implementation with Django REST Framework API Key
126
+ -------------------------------------------------------------
127
+
128
+ Instead of using knox, we can use `DRF API key `_,
129
+ it has the same features as knox, with the exception of:
130
+
131
+ - It is only used for authorization,
132
+ it can't be used for authentication (or it can't be out of the box).
133
+ - It doesn't expose views to revoke the tokens (but this should be easy to manually implement)
134
+ - Changing the behaviour of some things require sub-classing instead of defining settings.
135
+
136
+ The implementation will be very similar to the one described for knox,
137
+ with the exception that tokens won't be attached to users,
138
+ but just a project. And we won't be needing to handle authentication,
139
+ since the token itself will grant access to the projects.
140
+
141
+ To avoid breaking builders,
142
+ we need to be able to make the old and the new implementation work together,
143
+ this is, allow authentication and handle tokens at the same time.
144
+ This means passing valid user credentials together with the token,
145
+ this "feature" can be removed in the next deploy
146
+ (with knox we also need to handle both implementations,
147
+ but it doesn't require passing credentials with the token,
148
+ since it also handles authentication).
149
+
150
+ .. _DRF API key : https://florimondmanca.github.io/djangorestframework-api-key/
151
+
125
152
Future work
126
153
-----------
127
154
0 commit comments