เมื่อเร็วๆนี้ฉัน integrated superset กับของเว็บโปรแกรมดังนั้นเมื่อเป็นของผู้ใช้ใครคือการตรวจสอบสิทธิ์ของผมบนเว็บโปรแกรมสามารถป้อน superset แล้วมุมมอง/แก้ไข/สร้าง dashboards จากพื้นฐานของบทบาทเพิ่งได้โดยการคลิกที่อยู่เชื่อมโยงไม่ต้องการที่จะต้องการล็อกอิน สำหรับเรื่องนี้ฉันต้องผ่านล็อกอินสำหรับที่ฉันบอกชื่ องนี้ อีกนะ
กำหนดเอง SecurityManager ฉันเคยผ่านล็อกอิน
class CustomAuthDBView(AuthDBView):
@expose('/login/', methods=['GET', 'POST'])
def login(self):
redirect_url = self.appbuilder.get_url_for_index
user_name = request.args.get('username')
user_role = request.args.get('role')
if user_name is not None:
user = self.appbuilder.sm.find_user(username=user_name)
if not user:
role = self.appbuilder.sm.find_role(user_role)
user = self.appbuilder.sm.add_user(user_name, user_name, 'last_name', user_name + "@domain.com", role, password = "password")
if user:
login_user(user, remember=False)
return redirect(redirect_url)
else:
print('Unable to auto login', 'warning')
return super(CustomAuthDBView,self).login()
class CustomSecurityManager(SupersetSecurityManager):
authdbview = CustomAuthDBView
def __init__(self, appbuilder):
super(CustomSecurityManager, self).__init__(appbuilder)
ดังนั้นตามที่เหนือกฎการใช้ที่อยู่ url http://localhost:8088/login?username=John
จะล็อกอินของผู้ใช้จอห์นภายในร่างกายหรือผู้ใช้จอห์นยังไม่มีบัญชีถูกสร้างกับบทบาทซึ่งเป็นเรื่องเกี่ยวกับพวกบทบาทของผู้ใช้ในของโปรแกรมบนเว็บ
ตอนนี้ปัญหาคือใครที่สามารถเดาที่อยู่ url นี้ http://localhost:8088/login?username=USER_NAME
สามารถสร้างกองบัญชีผู้ใช้ใน superset ดังนั้นไงบ้างเพื่อปกป้องหรือปลอดภัยนี้ '/login'
endpoint