Skip to content
Snippets Groups Projects
Commit 229d52bc authored by Xiao Gui's avatar Xiao Gui
Browse files

fix: auth endpoint no-cache control

doc: labelled point assignment not working notice
parent 0ec5f9e6
No related branches found
No related tags found
No related merge requests found
......@@ -19,22 +19,37 @@ def get_user_from_request(request: Request):
return json.loads(user) if user else None
no_cache_header = {
"cache-control": "no-cache"
}
def is_authenticated(fn):
not_authenticated_response = Response("Not authenticated", 401, headers=no_cache_header)
@wraps(fn)
async def async_wrapper(*args, request: Request, **kwargs):
user = get_user_from_request(request)
if not user:
return Response("Not authenticated", 401)
return not_authenticated_response
request.state.user = user
return await fn(*args, request=request, **kwargs)
resp = await fn(*args, request=request, **kwargs)
if not isinstance(resp, Response):
return Response("is_authenticated did not return response", 500)
resp.headers["cache-control"] = "no-cache"
return resp
@wraps(fn)
def sync_wrapper(*args, request: Request, **kwargs):
user = get_user_from_request(request)
if not user:
return Response("Not authenticated", 401)
return not_authenticated_response
request.state.user = user
return fn(*args, request=request, **kwargs)
resp = fn(*args, request=request, **kwargs)
if not isinstance(resp, Response):
return Response("is_authenticated did not return response", 500)
resp.headers["cache-control"] = "no-cache"
return resp
return async_wrapper if iscoroutine(fn) else sync_wrapper
......@@ -47,8 +62,8 @@ def route_get_user(request: Request):
try:
user = request.state.user
if user:
return Response(json.dumps(user), 200)
return Response(json.dumps(user), 200, headers=no_cache_header)
else:
return Response(None, 401)
return Response(None, 401, headers=no_cache_header)
except:
return Response(None, 500)
return Response(None, 500, headers=no_cache_header)
......@@ -46,7 +46,7 @@
"python 3",
"typescript"
],
"schema:releaseNotes": "# v2.14.11\n\n## Feature\n\n- (experimental) showing coordinates of all warped spaces\n\n## Bugfix\n\n- Fixed inconsistent saneurl creation (Thanks to Sebastian Bludau for reporting this)\n",
"schema:releaseNotes": "# v2.14.11\n\n## Feature\n\n- (experimental) showing coordinates of all warped spaces\n\n## Bugfix\n\n- Fixed inconsistent saneurl creation (Thanks to Sebastian Bludau for reporting this)\n\n\n## Known regressions\n\n- Labelled assignment now does not work. This will be addressed in a future update. (The temporary regression allows for significant performant statistical assignment, as well more accurate label assignment.)\n",
"runtimePlatform": "docker",
"version": "2.14.11",
"contIntegration": "https://github.com/FZJ-INM1-BDA/siibra-explorer/actions",
......
......@@ -7,3 +7,8 @@
## Bugfix
- Fixed inconsistent saneurl creation (Thanks to Sebastian Bludau for reporting this)
## Known regressions
- Labelled assignment now does not work. This will be addressed in a future update. (The temporary regression allows for significant performant statistical assignment, as well more accurate label assignment.)
......@@ -17,7 +17,7 @@ const DOING_LABEL_ASGMT = "Probabilistic assignment failed. Performing labelled
const LABELLED_MAP_ASSIGNMENT_REGRESSION = `Labelled point assignment is currently experiencing some regression. For more detail, please visit
[https://siibra-explorer.readthedocs.io/en/stable/releases/v2.14.10/](https://siibra-explorer.readthedocs.io/en/stable/releases/v2.14.10/)`
[https://siibra-explorer.readthedocs.io/en/stable/releases/v2.14.11/](https://siibra-explorer.readthedocs.io/en/stable/releases/v2.14.11/)`
@Component({
selector: 'sxplr-point-assignment',
......
......@@ -7,8 +7,8 @@ export const environment = {
// N.B. do not update the SIIBRA_API_ENDPOINTS directly
// some libraries rely on the exact string formatting to work properly
SIIBRA_API_ENDPOINTS:
// 'http://localhost:5000/v3_0', // endpoint-local-10081
// // 'https://siibra-api-latest.apps-dev.hbp.eu/v3_0', //endpoint-latest
// 'http://localhost:5000/v3_0', // endpoint-local-10081
// 'https://siibra-api-latest.apps-dev.hbp.eu/v3_0', //endpoint-latest
// 'https://siibra-api-rc.apps.hbp.eu/v3_0', // endpoint-rc
// 'https://siibra-api-stable.apps.hbp.eu/v3_0', // endpoint-stable
'https://siibra-api-rc.apps.tc.humanbrainproject.eu/v3_0', // endpoint-rc-tc
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment