Beta

Create a tenant

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

Choosing which messages to protect

OpenID Connect lets several of its messages be signed, encrypted or both, and each layer has a cost. This lesson follows a security review of the collage app's sign-in, message by message, asking for each one who reads it along the way and who needs to check afterwards where it came from.

Messages that can be protected

Before launching the student discount from Combining claims from multiple sources, the collage company asks for a security review of its sign-in. The reviewer follows each message from where it is created to every place it is read, and two findings stand out. All domains, identifiers and tokens in these examples are fictional.

The first is the authentication request. When Ava chooses the discount, it carries a claims parameter asking for her Northfield enrollment status, and it travels through her browser's address bar, its history, any extension allowed to read page addresses, and the photo service's request logs. Anyone who sees it learns that the collage app asked whether Ava is a student. The second is the UserInfo response. HTTPS protects it only as far as the hosting company's load balancer, the front server where the connection ends. From there it crosses the collage company's internal network to the collage app's sign-in service, and Ava's name, email address and student status are then passed on to a separate order service, which has to take the sign-in service's word for where they came from.

OpenID Connect allows four of its messages to be signed with JSON Web Signature (JWS), encrypted with JSON Web Encryption (JWE), or both: the ID token, the UserInfo response, the request object, and the JWT a client uses to authenticate itself, its client assertion. Related specifications protect others in the same way, such as JARM for authorization responses. The defaults differ:

How each sign-in message is protected by default, and what more it can have
MessageCreated byBy defaultCan also be
Authentication requestThe collage appPlain parameters in the browser's addressA request object, signed by the collage app, encrypted to the photo service, or both
Authorization responseThe photo servicePlain parameters in the redirectSigned, and optionally encrypted to the collage app, with JARM
ID tokenThe photo serviceSigned, apart from one narrow caseAlso encrypted to the collage app
UserInfo responseThe photo servicePlain JSONSigned, encrypted to the collage app, or both
Client assertionThe collage appUsed only with JWT-based client authenticationAlways signed when used, and can also be encrypted

A message is signed with its creator's private key and encrypted with its reader's public key. The specifications also allow keys derived from a confidential client's secret, but a shared secret cannot show which of the two sides produced a message, so this group uses key pairs throughout. The JAR lessons and JARM lessons in Advanced OAuth applied these protections to requests and authorization responses. This group applies them to the messages OpenID Connect adds.

What a signature adds

Each protection should answer a question that someone actually needs answered. For a signature, the question is who needs to check where a message came from, and when.

For the ID token, the specification has already answered: ID tokens are signed. The one unsigned case, which Signing keys and rotation described, needs a client that registered for it, and the collage app never has.

A UserInfo response usually is not signed at all. The collage app requests it directly over HTTPS with its own access token, and checks that its sub matches the ID token. That connection shows the answer came from the photo service, but it shows this only to the sign-in service, and only while the connection lasts. The order service in the reviewer's second finding never saw that connection. If the photo service signs the response, the sign-in service can pass the signed JWT along, and the order service can verify it with the photo service's public key without trusting anything in between. A signed UserInfo response must also contain iss and aud, so the order service can check that it was the photo service's statement, made for the collage app.

Over HTTPS only

  • Sign-in service knows the sender
  • Order service can check who wrote it
  • Unreadable past the load balancer

The order service takes the sign-in service's word.

Signed by the photo service

  • Sign-in service knows the sender
  • Order service can check who wrote it
  • Unreadable past the load balancer

Carries iss and aud for the order service.

Signed, then encrypted

  • Sign-in service knows the sender
  • Order service can check who wrote it
  • Unreadable past the load balancer

The collage app's choice for UserInfo.

Anyone can encrypt to a public key, so an encrypted message on its own says nothing about who wrote it.

Ava's UserInfo response three ways. Only a signature travels with the response to the order service, and only encryption keeps it unreadable past the load balancer.

For the request, the reasoning runs the other way: the photo service is the one that needs to know the request is genuine. OpenID Connect's security considerations note that parameters such as max_age and acr_values give the provider more assurance about the authentication being requested when they arrive in a signed request, and the claims parameter is no different. The collage app still checks auth_time and acr in the ID token itself, as Session age and reauthentication and Authentication context and methods taught. The JAR lessons covered what a signed request object proves and how a provider validates one.

What encryption adds

For encryption, the question is who can read a message between the moment it is created and the moment its intended reader opens it.

The request object passes through the browser, which is exactly where the reviewer's first finding arose. Signing it hides nothing, because anyone holding a signed JWT can decode it. OpenID Connect's security considerations describe this case: knowing that a client asked for a particular claim, or a particular authentication method, can itself reveal something about the person. Encrypted to the photo service's public key, the request object keeps the claims request out of the address bar, history and logs, in a form only the photo service can open. Sending the object by reference, or pushing it with PAR, also keeps it out of the address bar. Encryption protects its contents wherever it is stored or passed along.

The ID token is a different case. With the code flow, it travels directly from the token endpoint to the collage app's backend over HTTPS, and in this example it contains no profile claims at all. Encryption matters more where an ID token passes through the browser, as it does in the implicit and hybrid flows covered in Response types, response modes, and older flows, or where a provider places sensitive claims in it. One detail catches out relying parties that do receive encrypted ID tokens. To send one later as an id_token_hint, the relying party must decrypt it and send the signed token inside, which it may encrypt again to the provider's own key.

The UserInfo response was the reviewer's second finding. Encrypted to the collage app's public key, it stays unreadable from the moment the photo service sends it until it reaches the one component that holds the collage app's private key, past the load balancer, the internal network and anything along the way that records request or response bodies.

Encryption has limits. Anyone can encrypt to a public key, so an encrypted message on its own says nothing about who wrote it, and encryption does nothing to stop a copied message being delivered again. It also hides the contents from the collage company's own monitoring, which is sometimes the point and sometimes an obstacle.

The collage app's choices

With those questions answered message by message, the collage company decides:

The collage app's decision for each message
MessageDecisionReason
Request objectSigned with the collage app's key collage-2026-10, then encrypted to the photo service, every timeThe photo service can rely on what the collage app asked for, and nobody along the way can read it. Encrypting only the requests that ask about enrollment would make exactly those requests stand out.
Authorization responseUnchanged: a code, state and iss, with PKCEIt carries nothing worth hiding, and PKCE protects the code. JARM remains available if the collage app later wants signed responses.
ID tokenSigned onlyIt arrives directly from the token endpoint and contains no profile claims.
UserInfo responseSigned, then encrypted to the collage appThe order service can verify the signature, and the encryption protects Ava's profile past the load balancer.

Each choice has a cost. The collage app must now publish an encryption key and replace it from time to time, the photo service must support every algorithm the collage app picks, and each added layer brings more algorithm combinations that both implementations must support and test. A provider that does not list an encryption algorithm in its discovery metadata cannot be asked to use it.

Check your understanding

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

The collage app's sign-in service passes UserInfo responses on to a separate order service. Which protection lets the order service confirm that the photo service wrote them? 1 of 3

Choose one answer.

Why does the collage app encrypt every request object, rather than only the ones that ask about Ava's student status? 2 of 3

Choose one answer.

The collage app uses the code flow, and its ID tokens hold no profile claims. A colleague proposes encrypting them too. What does the review conclude? 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