This might be a good order of the changes in this PR to review it:
Minor changes
removed custom http client, using aiohttp directly
formatted datasets.json
Authorization changes
added TLRU cache decorator (utils.caching)
added AccessRequest & AccessAnswer (webknossos.access)
As the Request should be cachable (via a dict), it needs __hash__ and __eq__.
I added them manually here, but it should be easier using namedtuple, see #30.
added request_access (webknossos.client)
added authorized decorator (webknossos.access)
checking authorization for dataset reading (__main__.py)
Testing
To test it
open the dataset in wk, should work.
curl with wrong token, gives 403.
curl -X POST http://localhost:8000/data/datasets/Connectomics_Department/test/layers/original-image/data?token=wrong
This might be a good order of the changes in this PR to review it:
Minor changes
datasets.json
Authorization changes
utils.caching
)webknossos.access
) As the Request should be cachable (via a dict), it needs__hash__
and__eq__
. I added them manually here, but it should be easier usingnamedtuple
, see #30.request_access
(webknossos.client
)authorized
decorator (webknossos.access
)__main__.py
)Testing
To test it
curl -X POST http://localhost:8000/data/datasets/Connectomics_Department/test/layers/original-image/data?token=wrong
fixes #3 partially