This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new de49f0d fix: add exception to catch session not having JWT (#14036)
de49f0d is described below
commit de49f0d2deb3e364059b6eb3f2c022ca624560da
Author: Hugh A. Miles II <[email protected]>
AuthorDate: Sun Apr 11 16:47:06 2021 -0400
fix: add exception to catch session not having JWT (#14036)
---
setup.cfg | 2 +-
superset/views/base.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/setup.cfg b/setup.cfg
index 9dd35f5..d1b2e4d 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -30,7 +30,7 @@ combine_as_imports = true
include_trailing_comma = true
line_length = 88
known_first_party = superset
-known_third_party
=alembic,apispec,backoff,bleach,cachelib,celery,click,colorama,contextlib2,cron_descriptor,croniter,cryptography,dateutil,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,freezegun,geohash,geopy,holidays,humanize,isodate,jinja2,jwt,markdown,markupsafe,marshmallow,marshmallow_enum,msgpack,numpy,pandas,parameterized,parsedatetime,pathlib2,pgsanity,pkg_resources,polyline,prison
[...]
+known_third_party
=alembic,apispec,backoff,bleach,cachelib,celery,click,colorama,contextlib2,cron_descriptor,croniter,cryptography,dateutil,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_jwt_extended,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,freezegun,geohash,geopy,holidays,humanize,isodate,jinja2,jwt,markdown,markupsafe,marshmallow,marshmallow_enum,msgpack,numpy,pandas,parameterized,parsedatetime,pathlib2,pgsanity,pkg_resour
[...]
multi_line_output = 3
order_by_type = false
diff --git a/superset/views/base.py b/superset/views/base.py
index 5eec560..140fa55 100644
--- a/superset/views/base.py
+++ b/superset/views/base.py
@@ -31,6 +31,7 @@ from flask_appbuilder.models.sqla.filters import BaseFilter
from flask_appbuilder.security.sqla.models import Role, User
from flask_appbuilder.widgets import ListWidget
from flask_babel import get_locale, gettext as __, lazy_gettext as _
+from flask_jwt_extended.exceptions import NoAuthorizationError
from flask_wtf.form import FlaskForm
from sqlalchemy import or_
from sqlalchemy.orm import Query
@@ -166,6 +167,9 @@ def api(f: Callable[..., FlaskResponse]) -> Callable[...,
FlaskResponse]:
def wraps(self: "BaseSupersetView", *args: Any, **kwargs: Any) ->
FlaskResponse:
try:
return f(self, *args, **kwargs)
+ except NoAuthorizationError as ex: # pylint: disable=broad-except
+ logger.warning(ex)
+ return json_error_response(get_error_msg(), status=401)
except Exception as ex: # pylint: disable=broad-except
logger.exception(ex)
return json_error_response(get_error_msg())