You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2021/04/08 21:58:34 UTC

[superset] branch hugh/no-jwt-400 created (now ca6c886)

This is an automated email from the ASF dual-hosted git repository.

hugh pushed a change to branch hugh/no-jwt-400
in repository https://gitbox.apache.org/repos/asf/superset.git.


      at ca6c886  add exception to catch session not having JWT

This branch includes the following new commits:

     new ca6c886  add exception to catch session not having JWT

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[superset] 01/01: add exception to catch session not having JWT

Posted by hu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch hugh/no-jwt-400
in repository https://gitbox.apache.org/repos/asf/superset.git

commit ca6c8860ef97d14c933c53dc085517f678bce9f3
Author: hughhhh <hu...@gmail.com>
AuthorDate: Thu Apr 8 17:57:36 2021 -0400

    add exception to catch session not having JWT
---
 superset/views/base.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/superset/views/base.py b/superset/views/base.py
index 5eec560..56d02b6 100644
--- a/superset/views/base.py
+++ b/superset/views/base.py
@@ -30,6 +30,7 @@ from flask_appbuilder.forms import DynamicForm
 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_jwt_extended.exceptions import NoAuthorizationError
 from flask_babel import get_locale, gettext as __, lazy_gettext as _
 from flask_wtf.form import FlaskForm
 from sqlalchemy import or_
@@ -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:
+            logger.exception(ex)            
+            return json_error_response(get_error_msg(), status=400)
         except Exception as ex:  # pylint: disable=broad-except
             logger.exception(ex)
             return json_error_response(get_error_msg())