Running SAML beside OpenID Connect
Most organizations that use SAMLThe Security Assertion Markup Language, a federation standard widely used for workplace single sign-on, in which the identity provider sends the application a signed assertion about the user. also use OpenID ConnectAn identity layer on top of OAuth 2.0 that lets an application sign people in with an account at another service. It adds the ID token, standard claims, and discovery to the OAuth exchange., often for the same people. This lesson follows Cedar Inc. while its training service moves from one protocolAn agreed set of rules for the messages two systems exchange and what each message means. HTTP, OAuth 2.0, OpenID Connect and SAML are all protocols. to the other: how the two agreements line up, how accounts carry across without guessing, what a broker between them does, and when the old path can go.
A migration with two entrances
Cedar Inc.'s training service has used SAML for years. This year Cedar Inc. also adopts a new expense application that supports only OpenID Connect, and the training vendor announces that its next version will prefer OpenID Connect too. Cedar Inc.'s identity providerA service that authenticates users and tells other applications about the sign-in, so those applications never handle the users' passwords. In OpenID Connect it is called an OpenID Provider. at https://login.cedar.example speaks both, so Avery keeps one sign-in while the applications behind it use different protocols, and each application moves on its own schedule.
The two protocols solve the same problem, telling an application who has signed in, with different messages. SAML sends a signed XML assertion through the browser to the application's assertion consumer serviceThe endpoint at a SAML service provider that receives the identity provider's response, usually as a form the browser posts. The service provider publishes its ACS URL in metadata, and the identity provider sends responses only there. (ACS), as How SAML sign-in works showed. OpenID Connect, introduced in From delegated access to sign-in, sends an authorization codeA short-lived, single-use value that the authorization server sends back to a client through the browser. The client swaps it for tokens in a direct request to the authorization server; APIs never accept it. through the browser and returns a signed JSONA text format for structured information, written as named values inside curly braces. APIs, tokens, and discovery documents all use it. ID tokenIn OpenID Connect, a signed JWT from the provider, addressed to one client, saying which account authenticated, when, and in answer to which request. It reports a sign-in and is not used to call APIs. over the back channel. An ID tokenA piece of data issued by a trusted service that a client presents as a credential, for example to call an API or to report a sign-in. Some tokens carry readable claims; others are random strings that only the issuer can interpret. is not an assertion, and neither one is an OAuthA framework that lets a person give an application limited access to their resources at another service, using tokens instead of sharing their password. OAuth is about access; OpenID Connect adds sign-in. access tokenA token that a client presents to an API to use access it has been granted, usually limited in what it allows and how long it lasts. It authorizes API calls; it does not tell the client who signed in.. Each application validates the result its own protocol defines.
For a while the training service has two entrances: the SAML one Avery has always used, and a new OpenID Connect one. Both lead to the same training records, which is what makes the move delicate.
Keep the two agreements explicit
Many SAML ideas have an OpenID Connect counterpart, which helps when you plan a migration, as long as you remember they are counterparts rather than copies. Each row below names a job both protocols do and the value each uses for it:
| Question | SAML | OpenID Connect |
|---|---|---|
| Who is the provider? | Entity ID, such as https://login.cedar.example | Issuer, the iss claim |
| Who is the application? | SP entity ID, checked as Audience | Client ID, checked as aud |
| Where do results go? | Registered ACS URL | Registered redirect URI |
| Which person? | NameID with its format and qualifiers | sub, unique within the issuer |
| When did they authenticate? | AuthnInstant | auth_time |
| How did they authenticate? | AuthnContextClassRef | acr and amr |
| Which request does this answer? | InResponseTo | state, and nonce inside the ID token |
| Where are keys and endpoints published? | Metadata XML | Discovery document and JWKS |
| How do sessions end together? | Single Logout | RP-initiated, front-channel and back-channel logout |
The table compares jobs, not values. Cedar Inc. may give Avery a different sub in OpenID Connect from her SAML NameIDThe value in a SAML assertion's subject that identifies the user to the service provider, in a declared format such as a persistent opaque identifier or an email address., especially if both are pairwise, so the training service cannot assume that sub equals cedar-training-742. Its SAML entity ID, https://training.example/saml, and its OpenID Connect client ID are different identifiers too. Each protocol's agreement is configured and validated on its own terms, with its own keys, its own return address and its own checks.
Map accounts without guessing the person
When the training vendor adds the OpenID Connect entrance, Avery's first sign-in through it arrives with a sub the training service has never seen. It must reach her existing account, the one linked to her SAML NameID, without creating a duplicate and without attaching to the wrong person.
The tempting shortcut is to match on email address. It is unsafe: an email claim is only a claim, two providers can state the same address, and an address can be reassigned. Two sound approaches exist. Cedar Inc. can supply a migration mapping from each SAML NameID to the matching sub, which it can produce because it issued both. Or the training service can link the two during a transition, by asking a person who signs in through the new entrance to also complete a sign-in through the old one, proving they control both.
Whichever route is used, the training service records each external identifier separately: (SAML issuer, NameID) and (OIDC issuer, sub), both pointing to one local account. It tests a returning person, a brand new person, someone whose email has changed, and two providers that state the same email. And it keeps rollback clean: turning off the new entrance must leave the SAML link and the account untouched.
When a broker sits between them
Sometimes the protocols meet in the middle. Cedar Inc. acquires Birch Ltd., whose staff sign in with a SAML identity provider, and Cedar Inc. wants them to use the OpenID Connect expense application without the application learning SAML. Cedar Inc. puts a federation broker in between. To Birch Ltd.'s identity provider, the broker is a SAML service provider. To the expense application, it is an OpenID Connect provider.
The broker does real work at each step. It validates Birch Ltd.'s SAML response exactly as any service provider would, with the checks from Validating a response, and a response that fails them ends the sign-in at the broker. It maps Birch Ltd.'s NameID to a subject of its own and chooses which attributes become claims. It applies Cedar Inc.'s policy, perhaps requiring multi-factor authentication for expense approvers. Then it issues a new ID token, signed with its own key, for the expense application as audience. The expense application trusts the broker's statement, not Birch Ltd.'s message, which never reaches it.
That translation is a place where meaning can slip. If Birch Ltd. sends a group called admins for its own IT staff, forwarding it unchanged could make them administrators in Cedar Inc.'s expense application. The broker maps upstream values to downstream ones deliberately, keeps a record of where each claim came from for support and audit, and does not hand applications the entire upstream assertion.
Retire the old path with evidence
Eventually the training service is fully on OpenID Connect and the SAML entrance can go. Before removing it, Cedar Inc. checks actual use: when did each SAML relationship last see a sign-in? One successful OpenID Connect sign-in does not prove every training site has moved. Logout needs the same care, since ending a session in one protocol does not end sessions created through the other.
The migration is finished when the intended people sign in through the new entrance and reach their own accounts, validation failures still refuse sign-in there, sessions end as expected, and a sign-in attempt through the retired SAML entrance is actually refused. Only then are the old SAML application, its ACS and its keys removed. Running both protocols for a while is a normal, supported state, and it is never a reason to relax either one's checks.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Compare two sign-in agreements without merging accounts by emailLink one application account to a SAML and an OpenID Connect entrance with fresh proofs from each, change the address, refuse a matching email from another issuer, and retire SAML.