Skip to content

Add OIDC authentication support for HTTP client testing#88

Merged
lambdalisue merged 3 commits intomainfrom
client-http-oidc
Jan 5, 2026
Merged

Add OIDC authentication support for HTTP client testing#88
lambdalisue merged 3 commits intomainfrom
client-http-oidc

Conversation

@lambdalisue
Copy link
Member

Summary

  • Update @probitas/client-http to ^0.7.0 to include OIDC capabilities
  • Add ./client/http/oidc subpath export for OpenID Connect authentication
  • Provide comprehensive example scenario demonstrating OIDC flows

Why

Testing modern web applications requires authenticating against OAuth 2.0/OIDC providers. This PR enables users to write scenarios that:

  • Test authenticated API endpoints without manual token management
  • Validate OIDC discovery and authorization code grant flows
  • Ensure token persistence across multiple requests

The example scenario demonstrates both auto-discovery (via /.well-known/openid-configuration) and manual OIDC configuration, covering common real-world use cases.

Changes

  • deno.json: Upgrade @probitas/client-http dependency and add OIDC subpath export
  • src/client/http/oidc.ts: Re-export OIDC client from framework package
  • src/client/http.ts: Expose OIDC namespace through client.http.oidc
  • probitas/16-client-http-oidc.probitas.ts: Complete example with 10+ test steps covering:
    • OIDC discovery endpoint validation
    • Authorization code grant with automated login
    • Automatic Authorization header injection
    • Token persistence across requests
    • Error handling for invalid credentials
    • Both auto-discovery and manual configuration patterns

Test Plan

  • Run deno task verify to ensure all checks pass
  • Verify OIDC example scenario runs successfully against echo-http service
  • Confirm OIDC authentication flow works with auto-discovery
  • Confirm OIDC authentication flow works with manual configuration
  • Verify authenticated requests include proper Authorization headers
  • Test error handling with invalid credentials

Copilot AI review requested due to automatic review settings January 5, 2026 16:57
@lambdalisue lambdalisue enabled auto-merge January 5, 2026 16:57
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds OpenID Connect (OIDC) authentication support to the HTTP client testing framework. It upgrades the @probitas/client-http dependency to version 0.7.0 and exposes OIDC functionality through a new subpath export.

Key Changes

  • Upgraded @probitas/client-http from v0.6.0 to v0.7.0 to enable OIDC capabilities
  • Added ./client/http/oidc subpath export for accessing OIDC-specific functionality
  • Created comprehensive example scenario demonstrating OIDC discovery, authorization code grant flow, and authenticated requests

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
deno.json Updated @probitas/client-http dependency to ^0.7.0, added OIDC subpath export, and updated related dependencies (@deno/graph, @faker-js/faker, @probitas/reporter)
deno.lock Automatic lock file updates reflecting dependency version changes
src/client/http/oidc.ts Simple re-export of OIDC functionality from the framework package
src/client/http.ts Exposed OIDC namespace through import and named export, consistent with SQL client pattern
probitas/16-client-http-oidc.probitas.ts Comprehensive example scenario demonstrating OIDC discovery, auto/manual configuration, authentication flows, token management, and error handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…o execution

Scenario files were failing to resolve bare specifiers because the
subprocess script runs from a temp directory, not the project directory.
While cwd was set correctly, Deno searches for deno.json relative to
the script file location, not cwd.

This fix automatically detects and passes --config=<path> to the
subprocess when neither --deno-config nor --deno-no-config is specified,
ensuring import maps work correctly for scenario files.

The implementation matches Deno's native behavior (since v1.18):
recursively searches from cwd upward through parent directories until
a config file is found or the filesystem root is reached.

Changes:
- Add hasConfigOption() to check if config option already specified
- Add findDenoConfig() to recursively locate deno.json/deno.jsonc
- Add ensureConfigOption() to auto-inject --config if needed
- Update spawnDenoSubprocess() to use ensured config options

Users can still override with --deno-config=<path> or opt out with
--deno-no-config to preserve existing behavior.
Expose OIDC (OpenID Connect) authentication capabilities through the
client.http.oidc namespace. This enables automated OAuth 2.0 flows
with token management for testing authenticated HTTP APIs.

Changes:
- Add ./client/http/oidc subpath export in deno.json
- Re-export @probitas/client-http/oidc through src/client/http/oidc.ts
- Provide comprehensive scenario example (16-client-http-oidc.probitas.ts)
  demonstrating authorization code grant flow with auto-discovery

The scenario validates:
- OIDC discovery endpoint integration
- Authorization code grant with automated login
- Automatic Authorization header injection
- Token persistence across multiple requests
- Manual OIDC configuration option
- Error handling for invalid credentials
@lambdalisue lambdalisue merged commit e2ec1e3 into main Jan 5, 2026
4 checks passed
@lambdalisue lambdalisue deleted the client-http-oidc branch January 5, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants