Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing auth check on websockets #287

Merged
merged 1 commit into from
Feb 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions backend/api/routers/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def deploy_app(template: schemas.DeployForm, Authorize: AuthJWT = Depends()):

@router.websocket("/{app_name}/livelogs")
async def logs(websocket: WebSocket, app_name: str, Authorize: AuthJWT = Depends()):
if settings.DISABLE_AUTH != True and settings.DISABLE_AUTH != "True":
auth_setting = str(settings.DISABLE_AUTH)
if auth_setting.lower() == "true":
try:
csrf = websocket._cookies["csrf_access_token"]
Authorize.jwt_required("websocket", websocket=websocket, csrf_token=csrf)
Expand All @@ -105,7 +106,8 @@ async def logs(websocket: WebSocket, app_name: str, Authorize: AuthJWT = Depends

@router.websocket("/{app_name}/stats")
async def stats(websocket: WebSocket, app_name: str, Authorize: AuthJWT = Depends()):
if settings.DISABLE_AUTH != True and settings.DISABLE_AUTH != "True":
auth_setting = str(settings.DISABLE_AUTH)
if auth_setting.lower() == "true":
try:
csrf = websocket._cookies["csrf_access_token"]
Authorize.jwt_required("websocket", websocket=websocket, csrf_token=csrf)
Expand Down Expand Up @@ -158,7 +160,8 @@ async def stats(websocket: WebSocket, app_name: str, Authorize: AuthJWT = Depend

@router.websocket("/stats")
async def dashboard(websocket: WebSocket, Authorize: AuthJWT = Depends()):
if settings.DISABLE_AUTH == "True":
auth_setting = str(settings.DISABLE_AUTH)
if auth_setting.lower() == "true":
pass
else:
try:
Expand Down