From 4fdd7c231c454f82291cf3cd29bd367a4b0e6497 Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Tue, 7 Jun 2022 21:09:38 +0300 Subject: [PATCH] sql_app: door: check if valid token on file requests Signed-off-by: HeshamTB --- sql_app/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql_app/main.py b/sql_app/main.py index 9a89d5c..2625d9c 100644 --- a/sql_app/main.py +++ b/sql_app/main.py @@ -323,7 +323,7 @@ def polling_method_for_room_monitor(request: schemas.IotMonitorRoomInfo, def get_allowed_usernames(request: schemas.IotDoorPollingRequest, db: Session = Depends(get_db)): - iot_door = crud.get_iot_entity_by_bluetooth_mac(db, request.bluetooth_mac) + iot_door : models.IotEntity = auth_helper.valid_iot_token(request, db) if not iot_door: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, @@ -339,7 +339,7 @@ def get_allowed_usernames(request: schemas.IotDoorPollingRequest, def get_allowed_usernames(request: schemas.IotDoorPollingRequest, db: Session = Depends(get_db)): - iot_door = crud.get_iot_entity_by_bluetooth_mac(db, request.bluetooth_mac) + iot_door : models.IotEntity = auth_helper.valid_iot_token(request, db) if not iot_door: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED,