File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
src/simcore_service_webserver/login/_controller/rest
tests/unit/with_dbs/03/login Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -153,17 +153,15 @@ async def logout(_body: LogoutBody):
153153
154154@router .get (
155155 "/auth:check" ,
156- operation_id = "check_authentication" ,
157156 status_code = status .HTTP_204_NO_CONTENT ,
158157 responses = {
159158 status .HTTP_401_UNAUTHORIZED : {
160159 "model" : EnvelopedError ,
161- "description" : "unauthorized reset due to invalid token code" ,
162160 }
163161 },
164162)
165163async def check_auth ():
166- """checks if user is authenticated in the platform """
164+ """checks whether user request is authenticated"""
167165
168166
169167@router .post (
Original file line number Diff line number Diff line change @@ -289,17 +289,18 @@ async def logout(request: web.Request) -> web.Response:
289289 return response
290290
291291
292- @routes .get (f"/{ API_VTAG } /auth:check" , name = "check_authentication " )
292+ @routes .get (f"/{ API_VTAG } /auth:check" , name = "check_auth " )
293293@login_required
294294async def check_auth (request : web .Request ) -> web .Response :
295- # lightweight endpoint for checking if users are authenticated
296- # used primarily by Traefik auth middleware to verify session cookies
295+ """Lightweight endpoint for checking if users are authenticated & authorized to this product
297296
297+ Used primarily by Traefik auth middleware to verify session cookies
298+ SEE https://doc.traefik.io/traefik/middlewares/http/forwardauth
299+ """
298300 # NOTE: for future development
299301 # if database access is added here, services like jupyter-math
300302 # which load a lot of resources will have a big performance hit
301303 # consider caching some properties required by this endpoint or rely on Redis
302-
303304 assert request # nosec
304305
305306 return web .json_response (status = status .HTTP_204_NO_CONTENT )
Original file line number Diff line number Diff line change 4141async def test_check_auth (client : TestClient , logged_user : UserInfoDict ):
4242 assert client .app
4343
44+ url = client .app .router ["check_auth" ].url_for ()
45+ assert url .path == "/v0/auth:check"
46+
4447 response = await client .get ("/v0/auth:check" )
4548 await assert_status (response , status .HTTP_204_NO_CONTENT )
4649
You can’t perform that action at this time.
0 commit comments