Skip to content

Commit 12d1360

Browse files
author
Andrei Neagu
committed
refactor interface
1 parent 626307e commit 12d1360

File tree

3 files changed

+10
-30
lines changed

3 files changed

+10
-30
lines changed

api/specs/web-server/_auth.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from simcore_service_webserver._meta import API_VTAG
2020
from simcore_service_webserver.login._2fa_handlers import Resend2faBody
2121
from simcore_service_webserver.login._auth_handlers import (
22-
CheckAuthBody,
2322
LoginBody,
2423
LoginNextPage,
2524
LoginTwoFactorAuthBody,
@@ -158,8 +157,8 @@ async def logout(_body: LogoutBody):
158157

159158
@router.get(
160159
"/auth:check",
161-
response_model=Envelope[CheckAuthBody],
162160
operation_id="check_authentication",
161+
status_code=status.HTTP_204_NO_CONTENT,
163162
responses={
164163
status.HTTP_401_UNAUTHORIZED: {
165164
"model": Envelope[Error],
@@ -168,7 +167,7 @@ async def logout(_body: LogoutBody):
168167
},
169168
)
170169
async def check_auth():
171-
"""checks if user is autheticated in the platform"""
170+
"""checks if user is authenticated in the platform"""
172171

173172

174173
@router.post(

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,11 @@ paths:
238238
tags:
239239
- auth
240240
summary: Check Auth
241-
description: checks if user is autheticated in the platform
241+
description: checks if user is authenticated in the platform
242242
operationId: check_authentication
243243
responses:
244-
'200':
244+
'204':
245245
description: Successful Response
246-
content:
247-
application/json:
248-
schema:
249-
$ref: '#/components/schemas/Envelope_CheckAuthBody_'
250246
'401':
251247
description: unauthorized reset due to invalid token code
252248
content:
@@ -4335,7 +4331,7 @@ paths:
43354331
'403':
43364332
description: ProjectInvalidRightsError
43374333
'404':
4338-
description: UserDefaultWalletNotFoundError, ProjectNotFoundError
4334+
description: ProjectNotFoundError, UserDefaultWalletNotFoundError
43394335
'409':
43404336
description: ProjectTooManyProjectOpenedError
43414337
'422':
@@ -6487,10 +6483,6 @@ components:
64876483
format: password
64886484
writeOnly: true
64896485
additionalProperties: false
6490-
CheckAuthBody:
6491-
title: CheckAuthBody
6492-
type: object
6493-
properties: {}
64946486
CheckpointAnnotations:
64956487
title: CheckpointAnnotations
64966488
type: object
@@ -7140,14 +7132,6 @@ components:
71407132
$ref: '#/components/schemas/CatalogServiceGet'
71417133
error:
71427134
title: Error
7143-
Envelope_CheckAuthBody_:
7144-
title: Envelope[CheckAuthBody]
7145-
type: object
7146-
properties:
7147-
data:
7148-
$ref: '#/components/schemas/CheckAuthBody'
7149-
error:
7150-
title: Error
71517135
Envelope_CheckpointApiModel_:
71527136
title: Envelope[CheckpointApiModel]
71537137
type: object

services/web/server/src/simcore_service_webserver/login/_auth_handlers.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ class LoginNextPage(NextPage[CodePageParams]):
7777
...
7878

7979

80-
class CheckAuthBody(BaseModel):
81-
...
82-
83-
8480
@routes.post(f"/{API_VTAG}/auth/login", name="auth_login")
8581
@on_success_grant_session_access_to(
8682
name="auth_register_phone",
@@ -313,9 +309,10 @@ async def check_auth(request: web.Request) -> web.Response:
313309
# used primarily by Traefik auth middleware to verify session cookies
314310

315311
# NOTE: for future development
316-
# if databse access is added here, services like jupyter-math
312+
# if database access is added here, services like jupyter-math
317313
# which load a lot of resources will have a big performance hit
318-
# consider caching some properties required by this endpoit or rely on Redis
314+
# consider caching some properties required by this endpoint or rely on Redis
315+
316+
assert request # nosec
319317

320-
_ = request
321-
return envelope_response(CheckAuthBody())
318+
return web.json_response(status=status.HTTP_204_NO_CONTENT)

0 commit comments

Comments
 (0)