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 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. 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 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., applies it to a stricter security profile. The OpenID Foundation, the organization that maintains 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., 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 certificationA scheduled or triggered check in which a responsible person looks at access someone already has and decides whether they should keep it. It is also called certification, and it leaves a record of who decided what. 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 authenticationChecking evidence that someone, or some application, controls an account, such as a password or a passkey. It establishes which account is being used, not what that account may do. 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 profile | What it covers |
|---|---|
| Basic | The authorization code flow, with response_type=code |
| Implicit | The implicit flow, with id_token and id_token token |
| Hybrid | The hybrid flow, with code id_token, code token, and code id_token token |
| Config | The discovery document published at /.well-known/openid-configuration |
| Dynamic | Dynamic client registration and the features that go with it |
| Form Post | The form_post response mode, for each flow the provider supports |
| Logout | RP-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 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. 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 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. whose 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. does not verify
- 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. whose
issis not the provider's issuerThe party that creates and signs a token, assertion, or certificate, named in a token's iss claim. A recipient must check that the issuer is exactly the one it expected and trusts. - an ID token whose
audis missing or does not include the client - an ID token whose
noncediffers from the one in the request - an ID token with no
subor noiat - an implicit or hybrid response whose
at_hashorc_hashis 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 nonceA random value used for one attempt only. In OpenID Connect, the client sends one in its sign-in request and checks that the same value comes back inside the ID token, showing the token answers this attempt. would carry on, perhaps calling the UserInfo endpointAn 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. 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.
Try it in the Lab
- Run the OpenID conformance suite against your tenantRun the OpenID Connect Basic provider test plan against your tenant, match its tests to your Audit, and tie every skipped test to what discovery advertises.