Beta

Create a tenant

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

Conformance testing

Conformance tests check an implementation against tests written independently from the specification. This lesson follows the collage app and the photo service through the OpenID Foundation's suite: how its tests and profiles work, what it asks a relying party to refuse, and what a passing result does and does not prove.

Tests written from the specification

All domains, identifiers, and tokens in these examples are fictional.

The collage app now signs people in with two providers, the photo service and the mail service, and its tests pass. Those tests were written by the collage app's own developers, from their own reading of the specification, against stand-in providers that misbehave in the ways the developers thought of. If they misread a rule, the code and its tests share the mistake, and both pass.

Conformance testing checks an implementation against tests written independently from the specification. Interoperability and conformance testing, in Advanced OAuth, applies it to a stricter security profile. The OpenID Foundation, the organization that maintains OpenID Connect, publishes a conformance suite that is free to use and open source. It plays whichever side of the exchange is not under test, and its results back a certification that implementers carry out themselves. Its test plans for OpenID Connect show what the specification expects of the collage app and of the photo service.

To test a provider, the tester gives the suite the provider's discovery address and registers clients whose redirect URIs point back to the suite, which then sends authentication requests and examines every response. To test a relying party, the tester configures it to use the suite as its provider and signs in through it, and the suite issues the codes, tokens, and key sets.

Tests are grouped into test plans, one for each profile and configuration, such as the code flow with a client registered in advance. Many tests are ordinary sign-ins examined closely. Others probe behavior the specification defines for unusual requests. A provider is sent prompt=none when no one is signed in and should answer with an error such as login_required. It is sent the same code twice and should refuse the second exchange. It is asked for max_age=1 and should make the person sign in again.

Some of these need a person. When the right behavior is a page the suite cannot see, such as a second sign-in page or an error page shown instead of a redirect, the tester uploads a screenshot of it, and the result waits for review.

Profiles and certification

A profile is a named set of features with its own test plan. A provider is tested against the profiles it claims to support:

Provider profileWhat it covers
BasicThe authorization code flow, with response_type=code
ImplicitThe implicit flow, with id_token and id_token token
HybridThe hybrid flow, with code id_token, code token, and code id_token token
ConfigThe discovery document published at /.well-known/openid-configuration
DynamicDynamic client registration and the features that go with it
Form PostThe form_post response mode, for each flow the provider supports
LogoutRP-initiated, session management, front-channel, and back-channel logout, each tested separately

Relying parties have matching profiles: the basic, implicit, and hybrid flows, configuration through discovery, dynamic registration, form post, and logout. Further plans cover features such as third-party initiated login, in which something other than the relying party, such as a portal page, asks it to start a sign-in.

Certification is self-certification: the implementer runs the plan for a profile against its own deployment and submits the logs, any screenshots, and a signed declaration. To qualify, no test in the plan may have failed or been interrupted, and the results behind OpenID Connect certifications are published, so anyone can see which tests were run and what happened.

A certification describes the deployment that was tested. The Foundation treats a different protocol endpoint as a different deployment that needs its own certification, and a certification for one profile says nothing about the others. A provider certified for the basic profile has not shown that its form post responses are right.

Testing a relying party

A provider's tests mostly check that it produces correct messages. A relying party's tests are more revealing, because the most important thing a relying party does is refuse. When the suite plays the provider, many of its tests send something wrong on purpose, and each of these should end without anyone being signed in:

  • an ID token whose signature does not verify
  • an ID token whose iss is not the provider's issuer
  • an ID token whose aud is missing or does not include the client
  • an ID token whose nonce differs from the one in the request
  • an ID token with no sub or no iat
  • an implicit or hybrid response whose at_hash or c_hash is missing or wrong

The suite cannot see the error page the relying party shows. It watches what the relying party does next. A relying party that accepted an ID token with the wrong nonce would carry on, perhaps calling the UserInfo endpoint with the access token it received, or in the hybrid flow redeeming the code. A relying party that refused makes no further request, and the test passes when nothing arrives within a waiting period.

Other tests check handling rather than refusal. The suite answers UserInfo with a different sub, and the relying party must discard that answer. It signs one ID token, then rotates its keys and signs the next with a key published only after the first sign-in, and the relying party must fetch the key set again and accept it. These are the same behaviors The UserInfo endpoint and Signing keys and rotation described, now checked by someone else.

The suite also follows the specification exactly where this series chose to be stricter. For an ID token received directly from the token endpoint in the code flow, the specification lets a relying party rely on its TLS connection instead of the signature, so a relying party that skips that signature check is not failed for it. The collage app verifies the signature anyway, as Receiving the ID token explained, and its own tests are where that choice is enforced.

What passing proves

A passing result describes one run: a plan, a version of the suite, a configuration and a date. When the collage app's developers keep a result, they keep those details with it, along with any test the suite skipped and why. A skipped test proves nothing either way. The suite skips tests for features the configuration does not advertise, so a skip is worth comparing with what the collage app actually does: a relying party that never asks for form post responses should skip the form post tests, and one that does should not.

Passing also has limits that no rerun can remove:

  • The configuration is the collage app's. A library certified with RS256 and the code flow says nothing about an application that configures it to accept other algorithms, widens its clock tolerance, or turns off the nonce check. The application inherits the certification's meaning only if it keeps the configuration that earned it.
  • Accounts and sessions are untested. No conformance test checks that the collage app finds accounts by issuer and subject rather than email, replaces its session identifier after sign-in, or ends its own session before redirecting to the provider at sign-out.
  • The faults are known ones. The tests cover the failure cases their authors chose. Passing them is not a security review of the collage app.

For the collage app, conformance tests and its own tests do different jobs. The suite checks the collage app's reading of the specification. The collage app's tests, built on the seams from Implementing a relying party, check the decisions the specification leaves to the collage app. Running the relying party test plans again before upgrading the library or changing its configuration catches regressions before customers meet them. When choosing a provider or a library, certification is a useful filter, as long as it covers the profiles the relying party will actually use.

Check your understanding

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

Acting as the provider, the conformance suite gives the collage app an ID token with the wrong nonce. How does the suite tell that the collage app refused it? 1 of 3

Choose one answer.

The collage app uses a library certified for the basic relying party profile. What does that certification tell you about the collage app? 2 of 3

Choose one answer.

The collage app asks the photo service for form_post responses, but its run of the relying party plan skipped every form post test. What does that suggest? 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