Skip to content

feat(auth): add profile synchronization and provisioning policy #646

Description

@XiaoSeS

Context

Follow-up to #628, #640, and the Binding V2 rollout. External login needs explicit ownership for profile fields and a provider-scoped provisioning decision instead of overwriting local/admin-maintained data.

Authoritative design: docs/21-unified-identity-federation-design.md, PR 3.

Scope

  • Persist profile field source and assurance metadata.
  • Add AUTO, APPROVAL, and EXISTING_BINDING_ONLY provisioning modes.
  • Add per-field synchronization policies.
  • Return a non-enumerating LINK_REQUIRED reason on verified-email collision without auto-binding.
  • Keep PENDING approval idempotent and add @global membership on approval.
  • Add audit records and bounded-cardinality login metrics.

Acceptance

  • User/admin-maintained profile values are not overwritten by default.
  • PENDING approve/reject/repeat-login behavior is transactional and deterministic.
  • Email collision creates neither an account nor a binding and returns no account identifier or link token.
  • Transaction failure leaves no orphan account, binding, subject, or profile source.
  • Real PostgreSQL integration tests and full backend regression pass.
  • Validate through big-main; do not merge directly to main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/m中等改动,存在一定协同成本 / Medium change with noticeable coordination cost.priority/p1高优先级 / High priority triage bucket.risk/high涉及安全、鉴权、迁移或公共契约 / Touches security, auth, migrations, or public contracts.triage/needs-info需要补充更多信息后才能分流 / Issue needs more detail before it can be routed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions