diff --git a/scripts/db/auth_strategy.py b/scripts/db/auth_strategy.py new file mode 100644 index 0000000..ac158b6 --- /dev/null +++ b/scripts/db/auth_strategy.py @@ -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, + } +) diff --git a/scripts/db/platform_defaults.py b/scripts/db/platform_defaults.py new file mode 100644 index 0000000..d8b527c --- /dev/null +++ b/scripts/db/platform_defaults.py @@ -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", +}