You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/03/05 05:57:14 UTC

[GitHub] [incubator-superset] betodealmeida commented on a change in pull request #6921: Redirection to shared url after login

betodealmeida commented on a change in pull request #6921: Redirection to shared url after login
URL: https://github.com/apache/incubator-superset/pull/6921#discussion_r262356464
 
 

 ##########
 File path: superset/superset_decorators.py
 ##########
 @@ -0,0 +1,33 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=C,R,W
+import functools
+
+from flask import redirect, session
+
+
+# Get target_url from session object and redirect to that url
+def redirect_to_target_url(f):
+    def wraps(self, *args, **kwargs):
+        if 'target_url' in session:
+            if session['target_url'] != '':
+                url = session['target_url']
+                session.pop('target_url')
+                return redirect(url)
 
 Review comment:
   Right. If you look at https://github.com/dpgaspar/Flask-AppBuilder/pull/910 (and how we do it in Airflow) you should cryptographically sign the target URL to make sure that a compromised auth provider doesn't send you to a malicious host.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org