dataflow-core 2.1.0__tar.gz → 2.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dataflow-core might be problematic. Click here for more details.
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/PKG-INFO +1 -1
- dataflow_core-2.1.1/authenticator/dataflowsupersetauthenticator.py +76 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow_core.egg-info/PKG-INFO +1 -1
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/setup.py +1 -1
- dataflow_core-2.1.0/authenticator/dataflowsupersetauthenticator.py +0 -66
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/README.md +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/authenticator/__init__.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/authenticator/dataflowairflowauthenticator.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/authenticator/dataflowhubauthenticator.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/__init__.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/configuration.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/database_manager.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/dataflow.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/db.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/environment.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/__init__.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/app_types.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/blacklist_library.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/connection.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/environment.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/environment_status.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/git_ssh.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/pinned_projects.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/project_details.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/recent_project_studio.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/recent_projects.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/role.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/role_server.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/runtime.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/server_config.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/session.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/team.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/user.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/user_environment.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/user_team.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/models/variables.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/scripts/clone_environment.sh +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/scripts/create_environment.sh +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/utils/__init__.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/utils/aws_secrets_manager.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/utils/get_current_user.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/utils/json_handler.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow/utils/logger.py +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow_core.egg-info/SOURCES.txt +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow_core.egg-info/dependency_links.txt +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow_core.egg-info/entry_points.txt +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow_core.egg-info/requires.txt +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/dataflow_core.egg-info/top_level.txt +0 -0
- {dataflow_core-2.1.0 → dataflow_core-2.1.1}/setup.cfg +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from flask import redirect, request, jsonify
|
|
2
|
+
from flask_appbuilder.security.views import AuthDBView
|
|
3
|
+
from flask_appbuilder.security.views import expose
|
|
4
|
+
from flask_login import login_user
|
|
5
|
+
from flask_jwt_extended import (
|
|
6
|
+
create_access_token
|
|
7
|
+
)
|
|
8
|
+
from flask_appbuilder.const import (
|
|
9
|
+
API_SECURITY_ACCESS_TOKEN_KEY
|
|
10
|
+
)
|
|
11
|
+
from superset.security import SupersetSecurityManager
|
|
12
|
+
from dataflow.dataflow import Dataflow
|
|
13
|
+
|
|
14
|
+
class DataflowAuthDBView(AuthDBView):
|
|
15
|
+
def __init__(self):
|
|
16
|
+
self.dataflow = Dataflow()
|
|
17
|
+
|
|
18
|
+
def create_user(self, user_details):
|
|
19
|
+
"""
|
|
20
|
+
Create a new user in Superset with the given details.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
User object: The newly created user instance
|
|
24
|
+
"""
|
|
25
|
+
return self.appbuilder.sm.add_user(
|
|
26
|
+
username=user_details['user_name'],
|
|
27
|
+
first_name=user_details.get("first_name", ""),
|
|
28
|
+
last_name=user_details.get("last_name", ""),
|
|
29
|
+
email=user_details.get("email", ""),
|
|
30
|
+
role=self.appbuilder.sm.find_role('Admin')
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
@expose('/login/', methods=['GET', "POST"])
|
|
34
|
+
def login(self):
|
|
35
|
+
"""
|
|
36
|
+
Handles both GET and POST login requests.
|
|
37
|
+
|
|
38
|
+
- GET: Used for browser-based login. Authenticates using session cookie and redirects to home.
|
|
39
|
+
- POST: Used for API-based login. Returns JWT access token for programmatic access.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
- Redirect to home page (GET)
|
|
43
|
+
- JSON response with access token (POST)
|
|
44
|
+
"""
|
|
45
|
+
if request.method == "GET":
|
|
46
|
+
session_id = request.cookies.get('dataflow_session')
|
|
47
|
+
user_details = self.dataflow.auth(session_id)
|
|
48
|
+
user = self.appbuilder.sm.find_user(username=user_details['user_name'])
|
|
49
|
+
try:
|
|
50
|
+
if user:
|
|
51
|
+
login_user(user, remember=False)
|
|
52
|
+
else:
|
|
53
|
+
user = self.create_user(user_details)
|
|
54
|
+
login_user(user, remember=False)
|
|
55
|
+
return redirect(self.appbuilder.get_url_for_index)
|
|
56
|
+
except Exception as e:
|
|
57
|
+
return super().login()
|
|
58
|
+
else:
|
|
59
|
+
user_details = request.get_json()
|
|
60
|
+
user = self.appbuilder.sm.find_user(username=user_details["user_name"])
|
|
61
|
+
if user:
|
|
62
|
+
login_user(user, remember=False)
|
|
63
|
+
else:
|
|
64
|
+
user = self.create_user(user_details)
|
|
65
|
+
login_user(user, remember=False)
|
|
66
|
+
resp = {
|
|
67
|
+
API_SECURITY_ACCESS_TOKEN_KEY: create_access_token(
|
|
68
|
+
identity=str(user.id), fresh=True
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
return jsonify(resp)
|
|
72
|
+
|
|
73
|
+
class DataflowSecurityManager(SupersetSecurityManager):
|
|
74
|
+
authdbview = DataflowAuthDBView
|
|
75
|
+
def __init__(self, appbuilder):
|
|
76
|
+
super(DataflowSecurityManager, self).__init__(appbuilder)
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
from flask import redirect, request, jsonify
|
|
2
|
-
from flask_appbuilder.security.views import AuthDBView
|
|
3
|
-
from flask_appbuilder.security.views import expose
|
|
4
|
-
from flask_login import login_user
|
|
5
|
-
from flask_jwt_extended import (
|
|
6
|
-
create_access_token
|
|
7
|
-
)
|
|
8
|
-
from flask_appbuilder.const import (
|
|
9
|
-
API_SECURITY_ACCESS_TOKEN_KEY
|
|
10
|
-
)
|
|
11
|
-
from superset.security import SupersetSecurityManager
|
|
12
|
-
from dataflow.dataflow import Dataflow
|
|
13
|
-
|
|
14
|
-
class DataflowAuthDBView(AuthDBView):
|
|
15
|
-
def __init__(self):
|
|
16
|
-
self.dataflow = Dataflow()
|
|
17
|
-
|
|
18
|
-
@expose('/login/', methods=['GET'])
|
|
19
|
-
def login_redirect(self):
|
|
20
|
-
try:
|
|
21
|
-
session_id = request.cookies.get('dataflow_session')
|
|
22
|
-
|
|
23
|
-
user_details = self.dataflow.auth(session_id)
|
|
24
|
-
user = self.appbuilder.sm.find_user(username=user_details['user_name'])
|
|
25
|
-
if user:
|
|
26
|
-
login_user(user, remember=False)
|
|
27
|
-
else:
|
|
28
|
-
user = self.appbuilder.sm.add_user(
|
|
29
|
-
username=user_details['user_name'],
|
|
30
|
-
first_name=user_details.get("first_name", ""),
|
|
31
|
-
last_name=user_details.get("last_name", ""),
|
|
32
|
-
email=user_details.get("email", ""),
|
|
33
|
-
role=self.appbuilder.sm.find_role('Admin')
|
|
34
|
-
)
|
|
35
|
-
if user:
|
|
36
|
-
login_user(user, remember=False)
|
|
37
|
-
|
|
38
|
-
return redirect(self.appbuilder.get_url_for_index)
|
|
39
|
-
|
|
40
|
-
except Exception as e:
|
|
41
|
-
return super().login()
|
|
42
|
-
|
|
43
|
-
@expose("/login", methods=["POST"])
|
|
44
|
-
def login_token(self):
|
|
45
|
-
login_payload = request.get_json()
|
|
46
|
-
user = self.appbuilder.sm.find_user(username=login_payload["user_name"])
|
|
47
|
-
|
|
48
|
-
if not user:
|
|
49
|
-
user = self.appbuilder.sm.add_user(
|
|
50
|
-
username=login_payload["user_name"],
|
|
51
|
-
first_name=login_payload.get("first_name", ""),
|
|
52
|
-
last_name=login_payload.get("last_name", ""),
|
|
53
|
-
email=login_payload.get("email", ""),
|
|
54
|
-
role=self.appbuilder.sm.find_role('Admin')
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
resp = dict()
|
|
58
|
-
resp[API_SECURITY_ACCESS_TOKEN_KEY] = create_access_token(
|
|
59
|
-
identity=str(user.id), fresh=True
|
|
60
|
-
)
|
|
61
|
-
return jsonify(resp)
|
|
62
|
-
|
|
63
|
-
class DataflowSecurityManager(SupersetSecurityManager):
|
|
64
|
-
authdbview = DataflowAuthDBView
|
|
65
|
-
def __init__(self, appbuilder):
|
|
66
|
-
super(DataflowSecurityManager, self).__init__(appbuilder)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|