This repository was archived by the owner on Dec 20, 2023. It is now read-only.
Use FastAPI Depends, improve ctxlize, context tests and header tests #71
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.
This PR is not super coherent, but I kept running into things I wanted to improve.
FastAPI Depends
apiserver/app/dependencies
for all the different possibilities. Now we can loadSource
and we can check the access tokens very easily, and also get the Contexts we want to pass to the functions we're calling.admin_router
, which automatically checks that an access token has "admin" scope. It automatically prefixes "admin" to all admin routes, which will properly distinguish them./classification/{rank_type}
are still kept until the frontend is updated. So the routes are now as follows:/admin/class/update/
/admin/class/get/{rank_type}/
/admin/class/sync/
/admin/class/events/user/{user_id}/
/admin/class/events/all/
/admin/class/users/event/{event_id}/
/members/class/get/{rank_type}/
Other
ctxlize
is nowctxlize_wrap
. Also added a more generalctxlize
. Add docs inside the module that explains everything in detail. Also added some Context docs. We don't use a special WrapContext anymore. You can just add them to whatever context you like.routers/helper
files could be removed.update
module for this.ResourceError
for all errors related to simple resource server functionality (in the OAuth sense). All the resource server logic has been moved to a newapiserver
submodule inlib/resource
. The header verification part that does not depend on loading data has been moved here. It now also returns the proper WWW-Authenticate header and conforms to the spec better.routers
folder./res/profile
is now a members route:<server>/members/profile
. The old route is still up while we update the frontend.jwt.decode
, we now use the correct options dict as the new version recommends.realm
(the WWW-Authenticate realm). No real functionality but the spec recommends it.datacontext/context.py
).Tests