Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

[POC] Edit dashboard #12

Merged
merged 44 commits into from
Apr 10, 2024
Merged

[POC] Edit dashboard #12

merged 44 commits into from
Apr 10, 2024

Conversation

quanvo0213
Copy link

@quanvo0213 quanvo0213 commented Mar 19, 2024

Please add in Config file




from flask_appbuilder.security.views import expose
from superset.security import SupersetSecurityManager
from flask_appbuilder.security.manager import BaseSecurityManager
from flask_appbuilder.security.manager import AUTH_REMOTE_USER
from flask import  redirect, request, flash
from flask_login import login_user

# Create a custom view to authenticate the user
AuthRemoteUserView=BaseSecurityManager.authremoteuserview
class CustomAuthUserView(AuthRemoteUserView):
    @expose('/login/')
    def login(self):
        token = request.args.get('token')
        next = request.args.get('next')
        isEmbeddedKatalonMode = request.args.get('isKatalonEmbeddedMode')
        projectId = request.args.get('projectId')
        accessToken = request.args.get('accessToken')
        sm = self.appbuilder.sm
        session = sm.get_session
        user = session.query(sm.user_model).filter_by(username='admin').first()
        if token == '1234abcd456':
            login_user(user, remember=False, force=True)
            if (next is not None):
                return redirect(next + '&isKatalonEmbeddedMode=' + isEmbeddedKatalonMode + '&projectId=' + projectId + '&accessToken=' + accessToken)
            else:
                return redirect(self.appbuilder.get_url_for_index)
        else:
            flash('Unable to auto login', 'warning')
            return super(CustomAuthUserView,self).login()

# Create a custom Security manager that overrides the CustomAuthUserView
class CustomSecurityManager(SupersetSecurityManager):
    authremoteuserview = CustomAuthUserView

# Use our custom authenticator
CUSTOM_SECURITY_MANAGER = CustomSecurityManager

# User remote authentication
AUTH_TYPE = AUTH_REMOTE_USER

@wiz-cloud-security
Copy link

wiz-cloud-security bot commented Mar 20, 2024

Wiz Scan Summary

IaC Misconfigurations 0C 0H 0M 0L 0I
Vulnerabilities 0C 0H 0M 0L 0I
Sensitive Data 0C 0H 0M 0L 0I
Total 0C 0H 0M 0L 0I
Secrets 0🔑

@huynguyen2908 huynguyen2908 merged commit a3968c3 into 3.1.0.katalon Apr 10, 2024
38 of 54 checks passed
@triquanminh triquanminh deleted the edit-dashboard-poc branch April 10, 2024 08:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants