Skip to content

[#1221] Characterize token endpoint errors and cache headers - #1240

Open
maximthomas wants to merge 2 commits into
OpenIdentityPlatform:features/1075-remove-restletfrom
maximthomas:features/1075-e2e-oauth2-token-cache
Open

maximthomas wants to merge 2 commits into
OpenIdentityPlatform:features/1075-remove-restletfrom
maximthomas:features/1075-e2e-oauth2-token-cache

Conversation

@maximthomas

@maximthomas maximthomas commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1221.

Ports six Restlet characterization tests from pre-flip commit 59a89d07cc (e2e/oauth2/oauth2-test.spec.mjs, lines 393–526). The tests pin the HTTP contract before those OAuth2 endpoints move to CHF.

  • POST /access_token with an unknown grant returns 400 unsupported_grant_type.
  • POST /access_token with the wrong secret for an existing confidential client returns 401 invalid_client and a Basic challenge.
  • GET /access_token returns 405 method_not_allowed and currently omits Allow. The target response includes Allow: POST (RFC 9110 §15.5.6). All three token endpoint errors carry Cache-Control: no-store and Pragma: no-cache.
  • GET /tokeninfo returns the issued token's JSON with Cache-Control: no-cache, no-store and no Pragma.
  • POST /introspect confirms the token is active and belongs to the test client, with neither cache header.
  • GET /userinfo with the same client credentials token returns 400 unauthorized_client with neither cache header.

The cache tests mint a token for a dedicated confidential client through the shared ensureClient fixture. The setup verifies the access token response and its cache headers. The dedicated client keeps this setup independent of other specs.

Changes to the source expectations:

  • Added both cache header assertions to the unknown grant and bad secret tests so each error independently pins the token endpoint's policy.
  • The GET token endpoint test checks the 405 status and the OpenAM-defined method_not_allowed error code. Restlet and CHF use different error_description wording.
  • Added the token type, presence and lifetime checks to token issuance and the token identity, client ID and expiry checks to token info so the cache assertions are tied to the expected successful response. The token info test checks the application/json media type and accepts parameters such as charset.
  • Added active: true and client identity checks to introspection so a 200 response for an inactive token or the wrong client cannot pass.
  • Added the observed UserInfo status and error code so an unrelated rejection cannot pass based on missing headers alone. The test records the target response as 401 with a Bearer invalid_token challenge. See OpenID Connect Core §5.3.3 and RFC 6750 §3.
  • Disabled redirect following for every request so the assertions apply to the endpoint response itself.

Validation used one OpenAM container with embedded OpenDJ, default file parallelism and retries: 0. The WAR came from CI run 43852682205, artifact 14222035312, built at 097005086e3113fcd81c382f4aa080ec2f823cf4. The SHA256 verified as 39599c6caf586b5e31b4971a76548b135eaaa20b9c99ec57e148f55cf0718cde, and the build source differs from the PR base only under e2e.

  • Both syntax checks and git diff --check passed. Playwright discovered 16 tests in the updated spec and 143 in oauth2 uma xacml.
  • All six new tests passed in separate --grep runs. A temporary copy with one deliberately incorrect assertion per test produced six expected assertion failures, then the restored tests passed together.
  • The complete spec passed twice on a fresh stand (16/16 each). The shared suite passed twice on another fresh stand (143/143 each). No tests were skipped. The earlier OIDC discovery failure did not recur.

@maximthomas maximthomas added enhancement javascript Pull requests that update Javascript code oauth2 OAuth2 / OpenID Connect tests Test suite: coverage, fixtures, or test infrastructure labels Nov 18, 2026
@maximthomas
maximthomas marked this pull request as ready for review November 18, 2026 14:16
@maximthomas
maximthomas requested a review from vharseko November 18, 2026 14:16

@vharseko vharseko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Scope client provisioning to the tests that use it

The file-level beforeAll now writes test_client_oauth2_b4b even when only an existing authorization-code or consent test is selected. With a local HTTP stub returning 403 for just that PUT, the base revision completed the authorization-code exchange and the PR revision stopped before reaching /authorize. Move the write into setup for the tests that use the new client. Fixture setup

[P3] Assert the realm value in the Basic challenge

/^Basic realm=/ accepts both a missing value (Basic realm=) and an unexpected realm. Restlet’s recorded response for this request is Basic realm="/". Checking the realm value would catch either regression during the CHF migration. Assertion · Restlet capture · RFC 7617 §2

Both changed files passed node --check, and git diff --check passed. Playwright discovered 16 tests in the changed spec and 143 across OAuth2, UMA, and XACML. CI skipped build-docker after the macOS/JDK 27 job was cancelled. My local run with the CI WAR timed out during deployment, before Playwright ran against the server. CI run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement javascript Pull requests that update Javascript code oauth2 OAuth2 / OpenID Connect tests Test suite: coverage, fixtures, or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants