feat(db): add auth_strategy constants and platform defaults
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
29
scripts/db/auth_strategy.py
Normal file
29
scripts/db/auth_strategy.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Auth strategy identifiers for accounts (v2 schema).
|
||||
|
||||
Imported by migration, repositories, and later CLI/service layers.
|
||||
"""
|
||||
|
||||
AUTH_STRATEGY_PASSWORD_AUTO = "password_auto"
|
||||
AUTH_STRATEGY_PASSWORD_WITH_CAPTCHA = "password_with_captcha"
|
||||
AUTH_STRATEGY_PASSWORD_PLUS_2FA = "password_plus_2fa"
|
||||
AUTH_STRATEGY_QR_CODE_MANUAL = "qr_code_manual"
|
||||
AUTH_STRATEGY_PER_SESSION_MANUAL = "per_session_manual"
|
||||
AUTH_STRATEGY_DEVICE_BOUND = "device_bound"
|
||||
AUTH_STRATEGY_CLIENT_CERTIFICATE = "client_certificate"
|
||||
AUTH_STRATEGY_API_TOKEN = "api_token"
|
||||
AUTH_STRATEGY_SSO_REDIRECT = "sso_redirect"
|
||||
|
||||
ALL_AUTH_STRATEGIES = frozenset(
|
||||
{
|
||||
AUTH_STRATEGY_PASSWORD_AUTO,
|
||||
AUTH_STRATEGY_PASSWORD_WITH_CAPTCHA,
|
||||
AUTH_STRATEGY_PASSWORD_PLUS_2FA,
|
||||
AUTH_STRATEGY_QR_CODE_MANUAL,
|
||||
AUTH_STRATEGY_PER_SESSION_MANUAL,
|
||||
AUTH_STRATEGY_DEVICE_BOUND,
|
||||
AUTH_STRATEGY_CLIENT_CERTIFICATE,
|
||||
AUTH_STRATEGY_API_TOKEN,
|
||||
AUTH_STRATEGY_SSO_REDIRECT,
|
||||
}
|
||||
)
|
||||
30
scripts/db/platform_defaults.py
Normal file
30
scripts/db/platform_defaults.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""平台默认 auth_strategy 映射表。
|
||||
|
||||
只覆盖已知平台;其它平台需要时手工 UPDATE platforms SET default_auth_strategy=... WHERE platform_key=...
|
||||
"""
|
||||
|
||||
PLATFORM_DEFAULT_AUTH_STRATEGY = {
|
||||
# 物流仿真平台(monitor-competitor-rates 在用)
|
||||
"maersk": "qr_code_manual",
|
||||
"cosco": "qr_code_manual",
|
||||
"msc": "qr_code_manual",
|
||||
# 内容平台(典型扫码)
|
||||
"douyin": "qr_code_manual",
|
||||
"wechat_mp": "qr_code_manual",
|
||||
"xiaohongshu": "qr_code_manual",
|
||||
"bilibili": "qr_code_manual",
|
||||
"toutiao": "qr_code_manual",
|
||||
"sohu": "qr_code_manual",
|
||||
# 开发平台(2FA 标配)
|
||||
"github": "password_plus_2fa",
|
||||
"aws": "password_plus_2fa",
|
||||
"gcp": "password_plus_2fa",
|
||||
# 内部演示/仿真(账密自动)
|
||||
"icbc_sim": "password_auto",
|
||||
# API 平台
|
||||
"openai": "api_token",
|
||||
"anthropic": "api_token",
|
||||
"deepseek": "api_token",
|
||||
"doubao": "api_token",
|
||||
}
|
||||
Reference in New Issue
Block a user