feat: add positive tests for the Authorization Code Grant (supersedes #267) (#364)

* feat: add positive tests for the Authorization Code Grant

* fix(auth): use import type for AuthorizationServerOptions in types.ts

* fix(auth): make client-id/client-secret optional; rename --secret→--client-secret

* fix(auth): generate PKCE verifier per-run; derive S256 challenge

* fix(auth): build authorization URL with URLSearchParams; drop hardcoded resource

* fix(auth): default token_endpoint_auth_methods_supported to client_secret_basic; add 'none' branch

* fix(auth): check auth-method support before starting callback server

* fix(auth): check error param first; treat state mismatch as fatal; drop fabricated code_challenge assertion

* fix(auth): redact tokens from check details

* fix(auth): harden callback server (path-scoped, close(), error handler, clear timeout)

* feat(auth): print redirect URI and timeout hint before browser prompt

---------

Co-authored-by: Michito Okai <michito.okai.zn@hitachi.com>
This commit is contained in:
Paul Carleton 2026-06-24 16:13:55 +01:00 • committed by GitHub
commit 565eaffc90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,10 +3,12 @@ import path from 'path';
import { ConformanceCheck } from '../types';
import { getClientScenarioForAuthorizationServer } from '../scenarios';
import { createResultDir, formatPrettyChecks } from './utils';
import { AuthorizationServerOptions } from '../schemas';
export async function runAuthorizationServerConformanceTest(
serverUrl: string,
options: AuthorizationServerOptions,
scenarioName: string,
details: Record<string, unknown>,
outputDir?: string
): Promise<{
checks: ConformanceCheck[];
@ -28,10 +30,10 @@ export async function runAuthorizationServerConformanceTest(
const scenario = getClientScenarioForAuthorizationServer(scenarioName)!;
console.log(
`Running client scenario for authorization server '${scenarioName}' against server: ${serverUrl}`
`Running client scenario for authorization server '${scenarioName}' against server: ${options.url}`
);
const checks = await scenario.run(serverUrl);
const checks = await scenario.run(options, details);
if (resultDir) {
await fs.writeFile(