修改SSO

This commit is contained in:
ZhuJW
2026-07-10 21:10:17 +08:00
parent fce40c7d6c
commit 6ebd45d894
14 changed files with 66 additions and 76 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ def create_app():
domain_prefix='accidentportal/api'
app.register_blueprint(auth_bp, url_prefix=f"/{domain_prefix}/api/auth")
app.register_blueprint(auth_bp, url_prefix=f"/{domain_prefix}/auth")
app.register_blueprint(login_bp, url_prefix=f"/{domain_prefix}/user")
app.register_blueprint(incident_gen5_bp, url_prefix=f"/{domain_prefix}/gen5")
app.register_blueprint(incident_gen6_bp, url_prefix=f"/{domain_prefix}/gen6")
+2 -2
View File
@@ -84,7 +84,7 @@ def authorized():
decoded_jwt = jwt.decode(access_token, options={"verify_signature": False})
# 5. 验证和清理 state 参数 (防止开放重定向攻击)
safe_state = "/callback"
safe_state = current_app.config["FRONTEND_CALLBACK_PATH"]
print(f"Redirecting to: {DOMAIN}{safe_state}")
# 6. 设置 Cookie
@@ -227,7 +227,7 @@ def authorized_test():
decoded_jwt = jwt.decode(access_token, options={"verify_signature": False})
# 5. 验证和清理 state 参数 (防止开放重定向攻击)
safe_state = "/callback"
safe_state = current_app.config["FRONTEND_CALLBACK_PATH"]
print(f"Redirecting to: {DOMAIN}{safe_state}")
# 6. 设置 Cookie
+6 -2
View File
@@ -51,6 +51,8 @@ class DevelopmentConfig(Config):
SS0_HOST = os.getenv("SS0_HOST","https://ssoalpha.dvb.corpinter.net.cn/")
REDIRECT_URL = os.getenv("REDIRECT_URL","http://localhost:5221/report")
DOMAIN = os.getenv("DOMAIN","http://localhost:3001")
# 前端回调路由(dev 根路径)
FRONTEND_CALLBACK_PATH = os.getenv("FRONTEND_CALLBACK_PATH", "/callback")
# 2. 开发模式开关
DEBUG = True
TESTING = True
@@ -69,8 +71,10 @@ class ProductionConfig(Config):
CLIENT_ID = os.getenv("CLIENT_ID","A17336FC-A8D7-4CEA-8777-384BFEABABC1")
CLIENT_PASSWORD = os.getenv("CLIENT_PASSWORD","U7-C1BZQdL8V5c.z~qA_64SO2l9F3J0o")
SS0_HOST = os.getenv("SS0_HOST","https://ssoalpha.dvb.corpinter.net.cn/")
REDIRECT_URL = os.getenv("REDIRECT_URL","http://localhost:5221/report")
DOMAIN = os.getenv("DOMAIN","http://localhost:3001")
REDIRECT_URL = os.getenv("REDIRECT_URL","https://cadb.dvb.corpinter.net.cn/accidentportal/api/incident/authorized")
DOMAIN = os.getenv("DOMAIN","https://cadb.dvb.corpinter.net.cn")
# 前端回调路由(prod 带域名前缀)
FRONTEND_CALLBACK_PATH = os.getenv("FRONTEND_CALLBACK_PATH", "/accidentportal/callback")
DEBUG = False # 禁用调试(关键!避免生产环境暴露敏感信息)
TESTING = False