Skip to content

Add provider-supplied request authentication#238

Open
chubes4 wants to merge 1 commit into
WordPress:trunkfrom
chubes4:custom-provider-auth
Open

Add provider-supplied request authentication#238
chubes4 wants to merge 1 commit into
WordPress:trunkfrom
chubes4:custom-provider-auth

Conversation

@chubes4
Copy link
Copy Markdown

@chubes4 chubes4 commented May 19, 2026

Summary

  • Add an optional provider contract for supplying a custom RequestAuthenticationInterface instance.
  • Teach ProviderRegistry to use provider-supplied authentication before falling back to metadata/env-derived authentication.
  • Add focused registry tests covering custom auth storage and model dependency binding.

Fixes #237.

Testing

  • php -l src/Providers/Contracts/ProviderWithRequestAuthenticationInterface.php && php -l src/Providers/ProviderRegistry.php && php -l tests/mocks/MockCustomRequestAuthentication.php && php -l tests/mocks/MockCustomAuthProvider.php && php -l tests/mocks/MockCustomAuthModel.php
  • vendor/bin/phpunit tests/unit/Providers/ProviderRegistryTest.php --filter 'testRegisterProvider(Uses|Binds)ProviderSuppliedRequestAuthentication'
  • composer phpcs && composer phpstan
  • composer test ran all 1090 tests/assertions, but this local PHP 8.5 runtime reports 83 existing reflection tests as risky because ReflectionMethod::setAccessible() / ReflectionProperty::setAccessible() now emit deprecations.

AI assistance

  • AI assistance: Yes
  • Tool(s): OpenCode (GPT-5.5)
  • Used for: Drafting the minimal provider-auth interface, registry wiring, focused tests, and local verification. Chris remains responsible for review and acceptance.

@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: chubes4 <extrachill@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.13%. Comparing base (99a65e8) to head (3624d24).

Additional details and impacted files
@@            Coverage Diff            @@
##              trunk     #238   +/-   ##
=========================================
  Coverage     88.12%   88.13%           
- Complexity     1213     1215    +2     
=========================================
  Files            60       60           
  Lines          3934     3937    +3     
=========================================
+ Hits           3467     3470    +3     
  Misses          467      467           
Flag Coverage Δ
unit 88.13% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Support provider-owned custom request authentication

1 participant