Browse Source

Fix auth error handling (#24420)

Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com>
Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
tags/1.8.0
Yongtao Huang 2 months ago
parent
commit
9a18911eba
No account linked to committer's email address
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      api/controllers/web/app.py

+ 7
- 2
api/controllers/web/app.py View File

import logging

from flask import request from flask import request
from flask_restx import Resource, marshal_with, reqparse from flask_restx import Resource, marshal_with, reqparse
from werkzeug.exceptions import Unauthorized from werkzeug.exceptions import Unauthorized


decoded = PassportService().verify(tk) decoded = PassportService().verify(tk)
user_id = decoded.get("user_id", "visitor") user_id = decoded.get("user_id", "visitor")
except Exception as e:
pass
except Unauthorized:
raise
except Exception:
logging.exception("Unexpected error during auth verification")
raise


features = FeatureService.get_system_features() features = FeatureService.get_system_features()
if not features.webapp_auth.enabled: if not features.webapp_auth.enabled:

Loading…
Cancel
Save