Skip to content
Directory
GitHub Star
Evidence, tags & source code

Migrating Agent Sign-In Without Losing Research Identity or Permissions ​

Suppose I maintain a personal research site and a separate report reader. They originally had independent sign-in systems, but I now want a common identity provider. Changing the login page to OIDC is easy to demonstrate. If old reports already belong to a business ID, however, successful login does not prove the user can still open them.

This is a synthetic migration scenario. Existing Open ETF Agent account isolation is not the same as the proposed third-party sign-in.

Preserve existing business identities ​

Suppose the research application identifies an account as user-demo-42, referenced by all of its historical reports. Bind a verified external identity to that ID rather than automatically creating another report owner.

ObjectMeaning
Issuer and subjectIdentity provider and stable subject
applicationUserIdDurable application business identity
MembershipPermission and role within this application
Resource permissionWhether the current user may access this report

OIDC Core 5.7 defines the issuer/subject combination as the stable identifier. Email and other claims lack the same guarantees. Pairwise subjects can also differ across clients; do not assume cross-application equality. Verify and explicitly bind old accounts. A mutable email is an aid to verification, not a reason to merge two accounts automatically.

Authentication starts access; application authorization continues it ​

Use a mature library for authorization codes, PKCE, state, nonce, signatures, issuer, audience and expiry. Accept only configured identity providers and callback addresses. Resolve the trusted session to the business identity, then check membership and resource ownership for pages, APIs and downloads. On logout or membership revocation, apply existing authorization contracts to background sending and research; closing a browser session is not equivalent to revoking every background job.

Avoid racing refresh tokens across tabs ​

With rotating refresh tokens, two requests entering a renewal window may attempt to refresh the same old token. Coordinate per session and reread the version after acquiring the lock; reuse a previously committed replacement if another request refreshed it. Store the new token safely before fetching application roles. A successful remote refresh followed by failed local storage needs explicit recovery or reauthentication, not unlimited reuse of the old token. See OAuth 2.0 Security BCP.

Multiple instances require shared coordination. If continuous sessions are unnecessary, reauthentication when a short session expires may be simpler; do not build a new identity center just for a demo.

Test more than the login screen ​

Choose two synthetic accounts and distinct reports. Verify that the old account can open its original report through the new entry and the other account cannot. Then exercise concurrent renewal, removal of the old entry, identity-provider failure and membership revocation, including download authorization. Preserve reviewed migration mappings and rollback conditions; never publish real mappings.

See the existing account identity article. Optional identity providers remain Planned in the application roadmap. This essay focuses on migrating business identities, not reimplementing account isolation.

Engineering notes, evidence and boundaries. · Contact: hpoenixf@foxmail.com · WeChat: hpoenixf0510