Quick revision
The short answer
In the short term, services accept tokens from both issuers through a resolver and a common claims mapping, so users from both companies can work immediately. For the long term, we pick one target identity provider or federation model with one token format for internal APIs, put federation or token exchange at the edge so internal services see a single issuer, migrate users and clients in planned waves with clear owners, and retire the second provider on a fixed date.
What to remember
In this answer, we separated the quick bridge from the target. Services first accept both issuers with a resolver and a shared claims mapping, which lets users work across the merged company at once but costs every team. We then chose one target provider or a federation model with criteria, put federation or token exchange at the edge so internal services see one issuer, migrated applications and users in owned waves, and retired the second provider on a published date so dual running does not become permanent.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
In the short term, services accept tokens from both issuers through a resolver and a common claims mapping, so users from both companies can work immediately. For the long term, we pick one target identity provider or federation model with one token format for internal APIs, put federation or token exchange at the edge so internal services see a single issuer, migrate users and clients in planned waves with clear owners, and retire the second provider on a fixed date.
Why this question is asked
After a merger, identity is one of the first systems people notice: employees of one company cannot open the other company's tools, and customers have two logins. The easy fix is to make every service trust both providers and stop there. Interviewers ask this to see whether a senior engineer can separate the quick bridge from the target architecture, and avoid the permanent cost of running two identity systems forever. In this answer, we will go through the short-term bridge, the choice of a target model, how to keep internal services simple with an edge layer, how to plan the migration waves, and why the retirement date matters as much as the design.
1Understanding the Starting Point
We have two identity providers, call them IdP A and IdP B. Each issues JWT access tokens with its own iss, its own signing keys and its own claims: A might put roles in a roles array and the user id in sub, while B uses groups and an employee number. Services from company A trust only A, and services from company B trust only B.
Two things must be true for users to cross over. A service must trust the other issuer's signature, and it must understand the other issuer's claims well enough to make the same authorization decision. The first is configuration; the second is where most mistakes happen.
2The Short-Term Bridge
For the first months, we let services accept both issuers. Each service uses a resolver such as JwtIssuerAuthenticationManagerResolver with the two trusted issuers, and a shared claims mapping in the platform library that turns both token formats into one internal principal: a user id, a company or tenant marker and a common set of roles. Roles from B are mapped to the role names A uses, agreed once with both security teams.
This works quickly, but notice its costs. Every service now holds two trust relationships, two key sets and mapping logic, and every new service must copy it. Every policy change, such as a new MFA rule, must be made in two providers. If we stop here, we pay that cost on every service for years. So the bridge is explicitly temporary, and we say so on day one.
3Choosing the Target Model
There are two realistic targets. In the first, we choose one provider as the identity provider for the merged company and migrate everyone to it. In the second, we keep both user directories for a while but put a federation layer in front: one provider becomes the broker, and users from the other company log in through it, with their home provider acting as an upstream identity source. In both cases internal APIs see one token format from one issuer.
We decide with criteria rather than loyalty: which provider covers both workforce and customer needs, which has the capabilities we need such as MFA, passkeys and federation, which contracts and licences run out first, which one the staff can operate, and how many users and applications sit on each. Often the larger installed base wins, but a provider that cannot meet compliance needs loses whatever its size.
| Aspect | Bridge (both issuers) | Target (one issuer inside) |
|---|---|---|
| Trust in each service | two issuers, two key sets | one issuer |
| Claims mapping | in every service library | once, at the edge or in the IdP |
| Policy changes (MFA) | made twice | made once |
| New service onboarding | copies both setups | standard setup |
| Running cost | two providers forever | one provider after retirement |
4Keeping Internal Services Simple With the Edge
The key architectural move is to make the difference disappear before requests reach internal services. At the edge, either the identity provider federates the other one, or the API gateway performs token exchange (RFC 8693): it accepts a token from either issuer, validates it, and exchanges it for a token from the target issuer with the standard claims. Internal services trust only that one issuer.
This also changes the migration. Once services trust one issuer, moving users from B to the target provider no longer touches services at all; it only changes what happens at the edge. That is the property we want, because it means the long tail of the migration is owned by the identity team rather than by every product team.
5Migrating in Waves and Retiring the Second Provider
We migrate in planned waves with named owners. Applications move first: each one switches from trusting its old provider to trusting the target issuer behind the edge. Then users move, in groups such as one business unit at a time, with password resets or passkey enrolment where hashes cannot be migrated. Partners and external clients come last, with notice.
Finally, we set and publish a retirement date for the second provider, tied to its contract end if possible. Without a date, the last few applications never move, the bridge becomes permanent, and the company pays for two providers and two sets of risks. With a date, the remaining work becomes a short list that someone owns. A senior engineer's job here is less about the technology and more about keeping that date credible: tracking progress per application, escalating blockers early, and refusing new integrations with the provider being retired.
6Follow-up questions
Why not keep both providers permanently and federate them?
Federation is a good transition and sometimes a long-term answer for separate customer bases. But for one workforce, two providers mean two places to apply security policy, two audit trails and two sets of staff skills. Unless there is a legal or business reason to keep them apart, the cost keeps growing and the benefit does not.
How do you handle users who exist in both providers?
We decide a matching rule, usually a verified email or an HR employee id, and link the accounts in the target provider before migration. Users with conflicts go into a manual review list, because silently merging two accounts can give one person the other's access.
Who should own the migration?
The identity or platform team owns the target, the edge and the plan, but each application team owns moving its application on the agreed date. Writing both kinds of ownership down at the start prevents the common outcome where everyone assumes someone else is moving the last applications.
7Conclusion
In this answer, we separated the quick bridge from the target. Services first accept both issuers with a resolver and a shared claims mapping, which lets users work across the merged company at once but costs every team. We then chose one target provider or a federation model with criteria, put federation or token exchange at the edge so internal services see one issuer, migrated applications and users in owned waves, and retired the second provider on a published date so dual running does not become permanent.
Open with
I would plan it in two horizons. Right away, I would let services accept tokens from both issuers, with JwtIssuerAuthenticationManagerResolver and a shared claims mapping in our platform library, so a user from either company becomes the same internal principal with agreed role names.
Then, if they want more
That unblocks people in weeks, but it puts two trust relationships and mapping logic into every service, so I would call it a temporary bridge from the first day.
For the long term, I would choose one target identity provider, or one broker that federates the other, based on capabilities, compliance, contracts, operating skills and the number of users and apps on each side.
The important architectural step is the edge: through federation or token exchange at the gateway, internal APIs see one issuer and one token format, so later user migration no longer touches the services. Then I would migrate applications and users in waves, each with a named owner, link duplicate accounts with a clear matching rule, and move partners last.
And I would publish a retirement date for the second provider, ideally tied to its contract end, and track it, because without a date dual running quietly becomes permanent.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- RFC 6749, The OAuth 2.0 Authorization Framework, Spring Security reference, OAuth2
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "After a merger, your company has two identity providers with different token formats and...": https://scrivio-interview-library.netlify.app/spring-boot/oauth2-and-oidc/1a6923fedc/