Combining claims from multiple sources
Some facts about a person belong to someone other than the provider that signs them in. This lesson follows the collage app as it offers Ava a student discount on the strength of her university's own statement, which the photo service passes on in one of two forms: the signed statement itself, or a reference the collage app follows to fetch it.
A statement the provider cannot make
The earlier 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. lessons cover everything an ordinary sign-in needs, from the request and the 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. to the account, the sessionThe ongoing connection between later requests and an earlier sign-in, so you are not asked for your password on every click. It is often tracked with a cookie holding an unpredictable session identifier. and logout. Advanced OpenID Connect turns to extensions that solve narrower problems. Plenty of relying parties never use them, but each answers a question the core design leaves open, and each builds on checks you already know.
The first question comes from the collage app's poster shop. Students get 20 percent off printed posters, and until now a student had to upload a picture of a student card, which someone at the collage company checked by eye. It is slow, and a picture of a card is easy to edit. Ava studies at Northfield University, and she signs in to the collage app at https://collage.example with her photo account, where she is user-2048. She would like the discount without the upload. All domains, identifiers and tokens in these examples are fictional.
The collage app already trusts the photo service to say who Ava is. It doesn't trust the photo service to say whether she is a student, and it shouldn't. The photo service has no authority over Northfield's enrollment records. If it simply added a claim of its own saying that Ava is a student, the collage app would be relying on the photo service for a fact the photo service can only repeat.
The party that can make the statement is the university. In OpenID Connect terms, Northfield is acting as a claims provider: a server that makes statements about a person. An OpenID 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. is one kind of claims provider, for the claims it issues itself. Here the photo service and Northfield are separate claims providers with different authority, and the collage app wants each fact from the one that knows it.
In this example, the photo service already holds what the collage app needs. When Ava chose its student storage plan in September, the photo service sent her to Northfield's sign-in at https://id.northfield.example, and Northfield gave the photo service a signed statement that she is enrolled. The photo service kept that statement, and it can pass it on, unchanged, to an application Ava approves.
The photo service says it
- Made by
- The photo service
- Signed with
- The photo service key
- Authority over enrollment
- None
- The collage app can check
- Only that it was repeated
A fact the photo service can only repeat.
Northfield's statement, unchanged
- Made by
- Northfield University
- Signed with
- northfield-2026-08
- Authority over enrollment
- Northfield's records
- The collage app can check
- That the university made it
Each fact from the one that knows it.
The photo service still decides which statement it attaches to user-2048.
OpenID Connect defines three ways a claim can appear in 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. or a UserInfoAn OpenID Provider endpoint that returns claims about the signed-in person to a client presenting an access token. Its sub must match the ID token's before the client uses anything it returns. response. Normal claims are statements the OpenID Provider makes itself, and every claim in the lessons from Standard and custom claims onward was one. Aggregated claims are statements from another claims provider that the OpenID Provider carries inside its own response, as the photo service is about to do. Distributed claims are references that the relying partyAn application that accepts and relies on a sign-in from another service, the name used in OpenID Connect and for passkeys. SAML calls the same role a service provider. follows to fetch a statement from the claims provider itself, which this lesson comes to once the aggregated form is clear. Every provider must support normal claims. The other two are optional, and a provider that supports them lists aggregated or distributed in the claim_types_supported field of its discovery metadata. A provider that leaves the field out supports normal claims only.
Reading the response
The collage app reads Ava's profile from the UserInfo endpoint, as it does at every sign-in. With the student statement included, the response looks like this, with the remaining profile claims left out and the embedded JWTA JSON Web Token: a compact token made of Base64url-encoded parts that carries claims and is usually signed. Anyone holding it can decode and read the claims, so the signature shows who issued it but hides nothing. shortened for display:
HTTP/1.1 200 OK
Content-Type: application/json
{
"sub": "user-2048",
"name": "Ava Archer",
"email": "[email protected]",
"email_verified": true,
"_claim_names": {
"https://id.northfield.example/enrolled": "src1"
},
"_claim_sources": {
"src1": {
"JWT": "eyJhbGciOiJFUzI1NiIsImtpZCI6Im5vcnRoZmllbGQtMjAyNi0wOCIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2lkLm5vcnRoZmllbGQuZXhhbXBsZSIs..."
}
}
}The student claim does not appear among the normal claims. Two special members describe where to find it instead. _claim_names maps each claim name to a source, here labeled src1. _claim_sources holds the source under that label. For an aggregated claim, the source is an object with a JWT member, and that JWT must contain every claim that _claim_names points to it. Several claims can share one source, and one response can hold sources from several claims providers. The label means nothing outside this response and says nothing about who signed the JWT. Only the JWT itself can tell the collage app that.
The claim's name is a URLA web address, such as https://photos.example/api/albums/42?limit=10. It names how to connect (https), the domain, the path to a particular page or resource, and any extra parameters after the question mark. in Northfield's domain. Custom claims need names that cannot collide with anyone else's, as Standard and custom claims explained, and here that matters even more: claim names from the photo service and from every claims provider share the one list in _claim_names.
Decoded, the embedded JWT reads:
Header:
{
"alg": "ES256",
"kid": "northfield-2026-08",
"typ": "JWT"
}
Claims:
{
"iss": "https://id.northfield.example",
"iat": 1789380000,
"exp": 1801353600,
"https://id.northfield.example/enrolled": true
}This is Northfield's statement, signed with Northfield's key northfield-2026-08. iss names Northfield, and the specification recommends that a claims provider always include it so that a relying party can find the keys to check the signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message.. iat records when Northfield made the statement, 10:00 UTC on 14 September 2026, and exp when it stops vouching for it, 31 January 2027. The statement was not made for this sign-in. It is already a few weeks old, and it will travel unchanged to every application Ava approves until it expires.
Notice what the JWT leaves out. There is no sub, so nothing in it names Ava, and no aud, so nothing names the collage app. The specification discourages a sub in these JWTs unless it is the person's identifier at the claims provider, and it says nothing about an audience. The photo service's response is what connects the statement to user-2048, and Validating aggregated and distributed claims looks at what that means for the collage app's trust.
A relying party that does not support aggregated claims sees two members it does not recognize and, following the usual rule for claims it does not understand, ignores them. It simply finds no student claim.
A reference instead of a statement
Northfield's statement was made in September and lasts until 31 January. If Ava left the university in October, the collage app would go on giving her the student discount for months, because the statement it received would still be genuine and unexpired. An aggregated claim is a snapshot. It records what the claims provider believed when it signed, which suits facts that rarely change, or ones a relying party only needs approximately. Enrollment changes during a term, and Northfield would rather each application asked when it needed to know.
The photo service has its own reason to prefer a different arrangement. Holding signed statements from universities, banks or employers means storing more about Ava than its own service needs, and keeping each statement current. It would rather tell the collage app where to ask.
A distributed claim does exactly that. Instead of the statement itself, the OpenID Provider sends a reference: the address of an endpoint at the claims provider, and usually an 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. that lets the relying party fetch the claim there. When Ava chooses the student discount and agrees to share her enrollment, the photo service can answer the collage app's UserInfo request like this, with the remaining profile claims left out:
HTTP/1.1 200 OK
Content-Type: application/json
{
"sub": "user-2048",
"name": "Ava Archer",
"email": "[email protected]",
"email_verified": true,
"_claim_names": {
"https://id.northfield.example/enrolled": "src1"
},
"_claim_sources": {
"src1": {
"endpoint": "https://id.northfield.example/claims",
"access_token": "demo-northfield-token-4"
}
}
}_claim_names and _claim_sources work exactly as they did for the aggregated claim. What changes is the source under src1: it has no JWT member, but two others:
endpoint, which is required, 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. protected resource at the claims provider: an API that accepts access tokens. The specification requires it to return the claim as a JWT, and the collage app expects that JWT to carry Northfield's signature, just as an aggregated statement does.access_token, which is optional, lets the relying party call that endpoint with an ordinary bearer token, sent in theAuthorizationheader. Claims providers must accept the token there.
The source object alone tells the collage app which kind of claim it is reading: a JWT member for an aggregated claim, an endpoint member for a distributed one. A single response can mix them, with normal claims from the photo service, an aggregated claim from one claims provider and a reference to another.
Nothing has been fetched yet. At this point the collage app knows only where Ava's enrollment status can be found, according to the photo service, and holds a token it could use to ask for it. It has no statement from Northfield at all until it makes the request itself and receives the statement directly from Northfield.
The access token in the reference
demo-northfield-token-4 was not issued by the photo service. A token for Northfield's endpoint has to come from Northfield's authorization server, because Northfield's endpoint is the one that must accept it. How the photo service obtains such a token is outside OpenID Connect. In this example, when Ava linked her Northfield account to the photo service, Northfield agreed that the photo service could request short-lived tokens that read only her enrollment status. When she agrees to share it with the collage app, the photo service requests one and places it in the reference.
The limit to one claim has to live in the token and in Northfield's endpoint. Naming only the enrollment claim in _claim_names does not narrow what a token can do. Had the photo service passed on its own, broader Northfield token instead, the collage app could have used it for everything that token allows.
That token is a bearer credential, and now the collage app holds it. Anyone who copies it from a log, or from anywhere else it travels, can read Ava's enrollment status until it expires. Everything Token theft and replay said about handling access tokens applies: keep it out of logs and out of anything sent to the browser, send it only to the endpoint it was issued for, and discard it once it has been used. Northfield limits the damage by issuing tokens that are short-lived, that read only this claim and that work only at this endpoint. This one was issued at 09:20 UTC, when Ava agreed to share her enrollment, and expires at 09:50.
The token is optional. Without one, the relying party must obtain access another way. The specification mentions a token arranged in advance between the claims provider and the relying party, or one obtained out of band, meaning through some arrangement outside this exchange, and allows the claims provider to ask the person to sign in or approve the release again. Each of those means more arrangements directly between the collage app and Northfield, which is much of what the reference was meant to avoid.
Asking for the claim
The collage app does not need Ava's enrollment status to make a collage, so it asks for it only when it matters. When she chooses the student discount at checkout, the collage app sends her through the photo service again with a request that adds the claims parameter from Scopes and the claims parameter. Before URL encoding, its value is:
{
"userinfo": {
"https://id.northfield.example/enrolled": null
}
}null asks for the claim in the default way, without marking it essential. The collage app asks for it under userinfo because, with the authorization code flow, it reads Ava's profile from the UserInfo endpoint anyway. A provider can equally carry an aggregated or distributed claim in an ID token, with _claim_names and _claim_sources among the token's claims.
The photo service decides the rest. The specification leaves it to the OpenID Provider to decide when to use aggregated or distributed claims, and relying parties and providers often agree on it in advance. Here the photo service asks Ava whether she wants to share her Northfield enrollment with the collage app. If she agrees, it adds the stored statement, or a reference to it, to the response. If she declines, or the statement has expired, the claim is simply missing, which is not an error. The collage app offers the card upload instead.
The collage app has preparation of its own to do. Accepting Northfield's statements is a trust decision separate from accepting the photo service's sign-ins, and the collage app records it in its own configuration: Northfield's issuer, where to find its keys, the algorithm it signs with, which claim names it may vouch for, and, for references, which endpoints the collage app agrees to call. Validating aggregated and distributed claims puts that configuration to work.
Aggregated or distributed
The two forms make different trade-offs for the same statement. Read each row as a question the collage company would ask before agreeing to one form or the other:
| Question | Aggregated | Distributed |
|---|---|---|
| How current is the statement? | As of when the claims provider signed it, possibly weeks earlier. | As of the moment the relying party asks. |
| Who learns that the collage app asked? | The photo service. Northfield signed the statement once and never sees where it goes. | Northfield as well, every time the collage app fetches the claim. |
| What must work when the collage app needs the claim? | The collage app, and Northfield's published keys. | Northfield's endpoint, and an access token that is still valid. |
| What does the collage app have to handle? | A signed statement. | A bearer token for another service's endpoint, and then a signed statement. |
| What does the OpenID Provider keep? | A copy of the statement. | Whatever it needs to obtain tokens from the claims provider. |
The privacy row cuts both ways. With an aggregated claim, the university never learns which applications Ava shared her status with. With a distributed claim, it observes each credential use and its timing. That may be more than Ava expected to share when she agreed to show the collage app she is a student, and the collage app can only limit it by asking rarely.
Because the OpenID Provider chooses which form to send, a relying party should be ready for whichever form its providers use, with the same configuration of trusted claims providers behind both.
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
- Carry Lab Mail's signed statement, then a reference to it, in Lab Photos' UserInfoLet Lab Photos carry Lab Mail's signed enrollment statement, switch it to a distributed reference, prove the reference's token reads only that claim, and see a declined share leave nothing to follow.