Skip to content

[#1221] Characterize userinfo and tokeninfo token transport - #1239

Merged
maximthomas merged 3 commits into
OpenIdentityPlatform:features/1075-remove-restletfrom
maximthomas:features/1075-e2e-oauth2-userinfo-tokeninfo
Nov 18, 2026
Merged

maximthomas merged 3 commits into
OpenIdentityPlatform:features/1075-remove-restletfrom
maximthomas:features/1075-e2e-oauth2-userinfo-tokeninfo

Conversation

@maximthomas

@maximthomas maximthomas commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1221.

Base: c3cefed8317776722cf30929152828b4849e0195. Final tested HEAD: 96917b77859b7661edfe24271fa470687623d79d.

Adds the b4a slice: five Restlet transport characterization tests ported from 59a89d07cc1d85dfdb3edeb2ceba4015b844073c:e2e/oauth2/oauth2-test.spec.mjs:308–390. They cover form-body userinfo, query/header tokeninfo, and rejection when the same valid token is supplied twice. All five existing tests and all nine device-flow tests remain unchanged.

The new group owns public client test_client_oauth2_b4a and obtains its own token through a cookie-backed authorization-code exchange with S256 PKCE. Each test can run alone. All five transport cases and the reference bearer-header GET use maxRedirects: 0 so a new redirect cannot hide a changed HTTP contract. Missing admin authentication now fails setup instead of skipping it. Trace and screenshot capture are disabled for the file because these Playwright options are worker-scoped.

Recorded contract and expectation changes

The five original status/error/grant/scope expectations all passed against the current Restlet implementation. No original expected result was replaced. The port adds stricter checks based on the live responses:

  • Form-body userinfo: HTTP 200, application/json;charset=UTF-8, and full JSON equality with a bearer-header GET using the same access token. The reference GET also requires HTTP 200; both requests disable redirects. The subject must equal USERNAME. Comparing the complete responses preserves transport equivalence while allowing profile-dependent claims such as given_name.
  • Duplicate header/form userinfo: HTTP 400, application/json, complete server_error with Access Token cannot be provided in both form and header. This preserves the existing defect; the comment names the target invalid_request from RFC 6750 section 3.1.
  • Query and header tokeninfo: HTTP 200, application/json, exactly access_token, client_id, expires_in, grant_type, profile, realm, scope, token_type; checks bind the response to the issued token and owned client, require authorization_code, exact scope [profile], empty profile, root realm /, Bearer, and a positive integer lifetime no greater than the issued token lifetime. Token comparison uses a boolean assertion to keep failure messages free of bearer credentials.
  • Duplicate header/query tokeninfo: HTTP 400, application/json, complete invalid_request with Access Token cannot be provided in both query and header.

No production code, shared fixtures, provider configuration, or workflows change. b4b–b4d and b5 remain separate work.

Validation through ea69082a89

  • Syntax check and discovery: 10 tests in the OAuth2 spec, 137 tests in nine shared files.
  • Original transported expectations: 5 passed, 0 failed, 0 skipped.
  • Transport group before the UserInfo claim-comparison update: 5 passed, 0 failed, 0 skipped; each test also passed alone.
  • Temporary expectation mutations: exactly 5 failed at the five intended assertions, 0 skipped; temporary copy removed.
  • Initial compatibility verification, before the redirect fix: full file twice on one fresh embedded OpenDJ stand: each run 10 passed, 0 failed, 0 skipped.
  • Initial compatibility verification, before the redirect fix: shared oauth2 uma xacml suite twice on its own fresh embedded OpenDJ stand: each run 137 passed, 0 failed, 0 skipped (nine files, parallel file execution, retries disabled).

An additional shared run after the two full-file runs returned 136 passed / 1 failed / 0 skipped. The unchanged OIDC discovery test at oidc-test.spec.mjs:136 expected openid, but discovery still advertised [profile] even though the admin provider API contained all four required scopes. The standalone OAuth2 file had initialized the provider before the shared helpers widened its configuration; RealmOAuth2ProviderSettings.getSupportedScopes() caches the value. The result is consistent with stale cached provider settings; its frequency and reproduction on the base under identical scheduling have not been established. The planned shared pair therefore uses a separate fresh stand. The observed failure is retained in the local validation summary and execution ledger; the original raw log was overwritten by a later successful run. No shared-provider or discovery-test code was changed.

An earlier review identified automatic redirect following as a coverage gap. With a temporary local proxy returning 307 before forwarding to the real OpenAM, all five tests passed before the fix. After disabling redirects, exactly five tests failed at their first status assertions (received 307, expected 200 or 400), with no skips. The proxy was stopped and is not part of the repository. Post-fix verification on the already configured embedded OpenDJ stand repeated the full file twice (10 passed each) and the shared suite twice (137 passed each), with zero failures or skips in all four runs.

Validation for 96917b7785

  • Local validation against OpenAM with embedded OpenDJ reproduced the previous fixed-key assertion failure with givenName: Demo, matching the CI user profile. After the update, all 10 tests in e2e/oauth2/oauth2-test.spec.mjs passed with that profile, with 0 failures or skips. The updated test also passed without givenName. See the local validation report.
  • Reviewer validation with synthetic HTTP responses confirmed that the updated test accepts profiles with and without given_name, and rejects a claim mismatch, a wrong subject, or a redirect from either request. See the review.
  • Rechecked node --check, git diff --check against the PR base, and Playwright discovery at this HEAD: all checks passed; 10 tests were discovered in the OAuth2 spec.
  • GitHub Actions run 44292021847 completed successfully for this HEAD: all nine Maven matrix jobs, build-docker, and Trivy passed. The build-docker log confirms Playwright actually ran: the full suite with HttpOnly disabled reported 154 passed, 0 failed, and 1 skipped (the XUI HttpOnly step-up test). All 10 OAuth2 tests, including the five transport cases, passed without skips. The separate XUI run with HttpOnly enabled reported 3 passed, 0 failed, and 0 skipped.

WAR provenance

Used the existing local WAR from CI Build run 43852682205, artifact 14222035312, source commit 097005086e3113fcd81c382f4aa080ec2f823cf4. SHA256 39599c6caf586b5e31b4971a76548b135eaaa20b9c99ec57e148f55cf0718cde verified both on disk and inside the test container. Compared with base c3cefed8317776722cf30929152828b4849e0195, only four e2e files differ; production sources are equivalent. The local image uses cached s6-openam:b3b-baseline with this verified WAR overlaid, and runs one OpenAM container with embedded OpenDJ. No WAR build or artifact download was performed.

@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 08:38
@maximthomas
maximthomas requested a review from vharseko November 18, 2026 08:38

@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.

[P1] Account for the CI user’s given_name in the form-body UserInfo test

The exact key assertion expects family_name, name, and sub. CI creates demo with givenName, and the previous build-docker run logged given_name: 'Demo' alongside those three claims. Restlet uses the same handler for GET and form POST, so the new assertion will reject a valid CI response. Please compare the form POST claims with the bearer-header GET response for the same token and keep the explicit POST status, content type, and subject checks. Assertion · Previous CI log

node --check and git diff --check passed. Playwright discovered all five new tests, and I confirmed that the new matcher rejects the claim set recorded in CI. Live E2E validation for this revision is pending. Current CI run

@maximthomas

Copy link
Copy Markdown
Contributor Author

@vharseko Addressed this review in 96917b7785.

The form-body UserInfo test now compares its full JSON response with a bearer-header GET using the same access token. The explicit POST HTTP 200, application/json;charset=UTF-8, and sub === USERNAME checks are preserved. The reference GET also requires HTTP 200, and both requests disable redirects.

Local validation against OpenAM with embedded OpenDJ:

  • Reproduced the original assertion failure with givenName: Demo, matching the CI user profile.
  • After the fix, all 10 tests in e2e/oauth2/oauth2-test.spec.mjs passed with that profile, with no failures or skips. The updated test also passed without givenName.
  • node --check and git diff --check passed.

@maximthomas
maximthomas requested a review from vharseko November 18, 2026 11:10

@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.

Reviewed 96917b7785. The previous UserInfo finding is resolved. The form POST compares the full JSON response with a bearer-header GET using the same access token. Both requests require HTTP 200 with redirects disabled. The POST still checks the exact content type and expected subject. Updated test

node --check and git diff --check passed, and Playwright discovered all 10 tests. In a focused run with synthetic HTTP responses, the previous revision failed on the CI-shaped profile with given_name. The updated test passed with and without that claim, and failed as expected on a claim mismatch, a wrong subject, or a redirect from either request. The current CI run is still in the Maven matrix, with build-docker pending. CI run

Please update the PR description to record the GET/POST comparison in place of the three-key assertion and include the validation for 96917b7785. Follow-up validation

@maximthomas
maximthomas merged commit e33f48d into OpenIdentityPlatform:features/1075-remove-restlet Nov 18, 2026
11 checks passed
@maximthomas
maximthomas deleted the features/1075-e2e-oauth2-userinfo-tokeninfo branch November 18, 2026 13:13
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