Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Migrating an identity provider

Moving an identity provider to a new platform has to carry across everything its relying parties depend on, much of which nobody wrote down. This lesson follows the photo service's migration: password hashes and lazy migration, the issuer and subjects the collage app stores for Ava, running both systems side by side, cutover and rollback, and telling people.

Moving the front door

The photo service has signed people in with its own system for ten years. That system issues the ID tokens the collage app validates when Ava Archer signs in, the SAML assertions an older greeting-card partner relies on, and the sessions behind every album. It is also showing its age, and the photo service has decided to move to a new identity platform. For its customers and partners, the goal is that nothing visible happens at all: the same sign-in page, the same accounts, the same connected applications, on a different engine.

That is harder than it sounds, because an identity provider is depended on in ways nobody wrote down. Relying parties store identifiers it issued. Browsers hold its cookies. Password hashes, authenticator registrations and refresh tokens were all made in formats the new platform did not choose. A migration that moves only the user table breaks every one of those quietly, usually on the morning after cutover. Migrating older integrations retired old patterns inside one authorization server; this lesson moves the whole server.

What a provider migration has to carry across
WhatWhy it is hard
Accounts and profilesThe easy part, if attribute names and formats are mapped carefully
PasswordsStored only as hashes, which cannot be turned back into passwords
Second factors and passkeysSecrets and public keys tied to the old system and its domain
Subject identifiers and the issuerStored by every relying party as the key to each account
Clients, signing keys and metadataRegistered and cached by relying parties
Sessions, refresh tokens and consentsLive state that people notice the moment it disappears

Bringing passwords across

The old system never stored passwords, only hashes of them, as Passwords and PINs explained. A hash cannot be reversed, so passwords cannot be exported. What can be exported is the hash itself, if the new platform can check passwords against it.

Most of the photo service's accounts have bcrypt hashes, which describe themselves:

text
$2b$12$R9h/cIPz0gi.URNNX3kh2OPST9/PgBkqquzi.Ss7KIUgO2t0jWMUW

2b names the algorithm, 12 the cost, and the next 22 characters are the salt, followed by the hash. A new platform that understands bcrypt can import this string and check passwords against it at the next sign-in. When the check succeeds, it holds the plaintext password for that moment, so it rehashes it with its own preferred algorithm, such as Argon2id, and discards the imported hash. Over a few months, every active account moves to the new format without anyone choosing a new password.

About 4 percent of accounts are older still, from before the photo service adopted bcrypt, and have salted SHA-1 hashes that the new platform will not accept, rightly, because SHA-1 is far too fast for passwords. One option is to wrap them: compute bcrypt over each old SHA-1 hash now, store that, and at sign-in compute SHA-1 then bcrypt over the typed password. That protects the old hashes immediately, but needs the new platform to support the custom combination. The photo service chose the other option for these accounts.

Lazy migration

In a lazy migration, accounts move one at a time, at the moment their owner signs in. The new platform holds every profile from the first day but no password for these accounts. When one of them signs in, it asks the old system, over a private connection, whether the password is right. If the old system says yes, the new platform stores its own hash and marks the account as migrated; the old system is never asked about that account again.

A lazy migration moves one account at its owner's next sign-in. Afterwards the old system is never asked about it again.

The private verification endpoint is the riskiest piece. It accepts passwords for any account, so it must accept requests only from the new platform, authenticate them, be rate-limited like a sign-in page, and never be reachable from the internet. It also inherits the old system's answers, so a locked or disabled account must be refused there too, not migrated.

Lazy migration has a long tail: people who sign in once a year will still be unmigrated a year later. The photo service set a date six months after cutover. Accounts still unmigrated then are sent through a password reset at their next sign-in, and the old system, with its endpoint, is switched off.

Second factors need the same care. Authenticator-app seeds can be exported if the old system can export them, and they must travel encrypted. Passkeys are bound to a relying party ID, the photo service's domain. If the new platform keeps the same relying party ID, each passkey's credential ID and public key can be imported and keep working; if the domain changes, every passkey has to be registered again.

Keeping subjects and issuers

The collage app knows Ava as the pair (https://auth.photos.example, user-2048), the issuer and subject from her first ID token, because OpenID Provider responsibilities promised that a subject is never reassigned and never changes. The new platform generates its own user IDs, such as 0f3c9a1e-77b2-4c8e-9d1a-5a4f2e6b8c30. If it put that value in sub, the collage app would receive an ID token for a person it has never seen.

What happens next depends on the collage app, and none of it is good. It might create a second, empty account, so Ava's collages seem to vanish. It might fall back to matching on her email address, the shortcut Connecting a sign-in to an account warned against. Multiply that by every relying party and every user, and a changed subject is a mass account-takeover risk as well as a support disaster.

So the subject moves with the account. The photo service imports each user with the old identifier kept as an attribute, and configures the new platform to issue that value as sub to every existing relying party. Pairwise subjects must be recalculated with the same sector identifiers and the same secret, so each relying party keeps receiving the same value. SAML is no different. Its assertions name the person with a NameID, and a persistent NameID plays the part of a stable subject, so the greeting-card partner's persistent NameID values must carry over exactly.

The issuer has to stay the same too. Relying parties compare iss exactly and store it with the subject, and they fetch discovery and keys from it. The photo service keeps https://auth.photos.example by serving the new platform on that hostname. It also publishes the new platform's signing key in its key set a few weeks before cutover, next to the old one, so relying parties that cache keys already know it when the first token signed with it arrives, the rollover described in Signing keys and rotation.

Running both side by side

Few migrations switch every application on one night. The photo service moves its relying parties in waves, starting with its own applications, where it controls both sides, then the collage app and other OpenID Connect clients, and last the SAML partner. During the waves both systems are live, and each application is sent to one of them.

Two arrangements make that work. In one, the new platform answers at the old hostname and passes the protocols it has not taken over yet to the old system behind it. In the other, the new platform acts as a broker: to the applications not yet moved it is their provider, and out of sight it signs people in through the old system and passes the result on. Whatever passes through a broker must arrive with the same identifiers and the same meaning, or the applications behind it open the wrong accounts. Running SAML beside OpenID Connect, in the SAML lessons, follows a broker that also translates between protocols.

Each wave is tested against real relying parties before it goes live, using a test environment with copies of their registrations. The test that matters most is the dull one: sign in as an existing user through the new platform and confirm the relying party opens the same account as yesterday.

Cutover and rollback

On the night of a wave's cutover, traffic for that wave moves to the new platform. Existing sessions in the old system end, so people sign in once more. Refresh tokens are the sharpest edge: the collage app holds refresh tokens the old system issued, which the new platform cannot honor unless they were migrated with their grants. The photo service migrated the grants and their consents, so Ava's year-end collage keeps arriving each December; without that, every connected application would have needed her to approve it again.

A plan to go back is part of the plan to go forward. Until a wave's point of no return, the old system stays ready, and every change made in the new platform that the old one would need, such as a new account, a changed password or a removed authenticator, is copied back to it. Rolling back is then a routing change. After the point of no return, which the photo service set at two weeks per wave, changes stop flowing back, and fixing forward is the only direction.

Telling people

A migration that works technically can still fail through surprise. The photo service wrote to three audiences, each with what they needed.

Customers were told the date, that they would be asked to sign in once more, and that the photo service would never ask for their password by email, because a migration announcement is a phishing template waiting to be copied. Relying party owners received the dates, the test environment, and a list of what would stay identical, the issuer, the subjects and the endpoints, together with the one thing that would change, the new signing key, weeks ahead. The help desk received the expected questions and a way to tell a migrated account from an unmigrated one, since most calls in the first week would be about passwords that worked yesterday.

When the last wave passed its point of no return and the long tail of resets was done, the old system was switched off. The collage app never noticed: its stored pair still matched, its keys had already been fetched, and Ava's collages were where she left them.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

The new platform issues its own user IDs as sub. The issuer URL stays the same. What happens when Ava next signs in to the collage app, which stored her issuer and old subject? 1 of 3

Choose one answer.

During a lazy migration, the new platform checks unmigrated passwords against the old system's verification endpoint. Which design is right for that endpoint? 2 of 3

Choose one answer.

The photo service's new platform will serve sign-in from a new domain instead of the old one. What happens to the passkeys its customers registered? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity