Skip to main content

GSS UC Integration — 用户中心 SSO / 主数据同步(Fred 子系统共享包)

将各子系统里同构的 modules/uc_integration 抽成可安装包,避免复制粘贴分叉。

能力

接口 说明
GET /{subsystem}/uc_integration/auth/sso/config 登录模式
POST /{subsystem}/uc_integration/auth/sso/exchange UC code/accessToken → 本地 JWT
POST /{subsystem}/uc_integration/auth/sso/refresh UC refreshToken 续期
POST /{subsystem}/uc_integration/internal/uc-sync UC 主数据推送(仅本机)
GET /{subsystem}/uc_integration/internal/uc-sync 同步健康检查

本地 JWT 的 sub 含:

  • 本地身份:id / username / name / store_id / store_ids / role
  • uc:UC validate/exchange 原样透传(不做字段白名单)

安装

# 开发:可编辑安装
pip install -e /path/to/uc-integration

# 或从 git
pip install "gss-uc-integration @ git+ssh://git@github.com/org/uc-integration.git"

Fred 只从项目 modules/ 扫描蓝图,安装后必须链接:

# 在子系统根目录(含 modules/)
python /path/to/uc-integration/scripts/link_to_project.py .
# 或覆盖已有 symlink
python /path/to/uc-integration/scripts/link_to_project.py . --force

等价手动操作:

ln -sfn "$(python -c 'import uc_integration,pathlib; print(pathlib.Path(uc_integration.__file__).parent)')" \
  modules/uc_integration

宿主配置

common/config/Config.py(或等价配置):

LOAD_CUSTOM_MODULES = [..., "uc_integration"]

SSO_LOGIN_MODE = 'uc'                    # 或 'local'
UC_SUBSYSTEM_CODE = 'ai_check'           # 路由前缀:/{code}/uc_integration
USER_CENTER_BASE_URL = 'http://127.0.0.1:5001'
USER_CENTER_INTERNAL_SECRET = '...'      # 与 UC OPEN_API_INTERNAL_SECRET 一致

# 可选
UC_INCLUDE_STORE_SCOPE = True            # JWT 写入 store_ids / role(默认 True)
UC_STORE_FALLBACK_FIRST = True           # 无匹配门店时回退第一个(默认 True)

宿主前置条件

  • 本地库有 uc_user / uc_store 等镜像表(可由 sync DDL 自动建)
  • ORM:model.model 中存在 UcUser(以及门店 scope 需要的 UcDept 等)
  • 依赖:fred_admin、Flask、SQLAlchemy(由子系统环境提供)

目录结构(Fred 兼容)

uc_integration/
  __init__.py              # 导出蓝图
  backend/
    __init__.py            # Blueprint + url_prefix
    deps.py                # 惰性解析 model.model
    controller/
    service/
    schema/

从旧模块迁移

  1. pip install -e ../uc-integration
  2. 备份并删除子系统 modules/uc_integration
  3. python ../uc-integration/scripts/link_to_project.py .
  4. 确认 UC_SUBSYSTEM_CODE 与门户子系统编码一致
  5. 验证 GET /{code}/uc_integration/auth/sso/config

版本

当前 0.1.0,以 ai_check(UC 原样透传)+ todo(门店 scope / 动态前缀)合并为基准。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uc_integration-0.1.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uc_integration-0.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file uc_integration-0.1.0.tar.gz.

File metadata

  • Download URL: uc_integration-0.1.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for uc_integration-0.1.0.tar.gz
Algorithm Hash digest
SHA256 563d4dfc9678645ece02afc9921317e26752f0b8822e1a8354174c9637a1a8bb
MD5 fb0a94fa5705c63b6ed7880a073f0c3e
BLAKE2b-256 83b45bfa70cea7c010e7462473764e2e7dfc4629505c9ca8fe5732a4a57f9704

See more details on using hashes here.

File details

Details for the file uc_integration-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: uc_integration-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for uc_integration-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52e1fc2c5ddc3b01ab24ae4380f9e0d4df2f3f1fe5e1da47e4f2850466d597a3
MD5 0c2fb1d814f5f64b1eab2b3747abc09f
BLAKE2b-256 a78b662f724a9fb04017185b0667772046463dc37d4cf09482a84c99b90df0ee

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.5

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page