Support attribute-based plugin discovery

Created on 21 November 2024, 5 months ago

Problem/Motivation

Since version 10.2.0, Drupal has supported plugin definition discovery via PHP attributes. The plugin types for the OAuth2 Client mode Oauth2Client and Oauth2GrantType, as well as their plugin managers, can be updated to support plugin discovery.

Steps to reproduce

Proposed resolution

  1. Update core_version_requirement to ^10.2 || ^11
  2. Create Oauth2Client and Oauth2GrantType attribute classes
  3. Update Oauth2ClientPluginManager and Oauth2GrantTypePluginManager to support discovery by the new attributes
  4. Convert module-provided plugins to use attributes instead of annotations
  5. Provide one test plugin still using annotations to test for backwards compatibility

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Active

Version

4.1

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @godotislate
  • Pipeline finished with Failed
    5 months ago
    Total: 140s
    #346269
  • Pipeline finished with Success
    5 months ago
    Total: 138s
    #346273
  • Pipeline finished with Success
    5 months ago
    Total: 345s
    #346282
  • Note that this would need a core minimum of 10.2.

  • πŸ‡ΊπŸ‡ΈUnited States fathershawn New York

    Thank you for such a well executed contribution!

    I see that all tests passed in GitLab. Checking out the MR and running tests in DDEV via ddev-selenium-standalone-chrome:1.1.0 I get a couple of things:

    HTML output was generated.
    https://oauth2-client.ddev.site/sites/simpletest/browser_output/Drupal_Tests_oauth2_client_Functional_Oauth2ClientCollectionTest-93-40265769.html
    https://oauth2-client.ddev.site/sites/simpletest/browser_output/Drupal_Tests_oauth2_client_Functional_Oauth2ClientCollectionTest-94-40265769.html
    https://oauth2-client.ddev.site/sites/simpletest/browser_output/Drupal_Tests_oauth2_client_Functional_Oauth2ClientCollectionTest-95-40265769.html
    https://oauth2-client.ddev.site/sites/simpletest/browser_output/Drupal_Tests_oauth2_client_Functional_Oauth2ClientUpdateTest-153-31269380.html
    
    
    Time: 00:06.686, Memory: 6.00 MB
    
    There was 1 failure:
    
    1) Drupal\Tests\oauth2_client\Functional\Oauth2ClientUpdateTest::testOauth2UpdateHooks
    The link Continue was not found on the page.
    Failed asserting that an array has the key 0.
    
    /var/www/html/docroot/core/tests/Drupal/Tests/UiHelperTrait.php:456
    /var/www/html/docroot/core/tests/Drupal/Tests/UpdatePathTestTrait.php:50
    /var/www/html/docroot/modules/oauth2_client/tests/src/Functional/Oauth2ClientUpdateTest.php:78
    
    --
    
    2 tests triggered 1 deprecation:
    
    1) /var/www/html/vendor/symfony/error-handler/DebugClassLoader.php:341
    Method "League\OAuth2\Client\OptionProvider\OptionProviderInterface::getAccessTokenOptions()" might add "array" as a native return type declaration in the future. Do the same in implementation "Drupal\oauth2_client\OAuth2\Client\OptionProvider\ClientCredentialsOptionProvider" now to avoid errors or add an explicit @return annotation to suppress this message.
    
    Triggered by:
    
    * Drupal\Tests\oauth2_client\Kernel\Oauth2ClientEntityKernelTest::testClientCredGetToken
      /var/www/html/docroot/modules/oauth2_client/tests/src/Kernel/Oauth2ClientEntityKernelTest.php:153
    
    * Drupal\Tests\oauth2_client\Kernel\Oauth2ClientEntityKernelTest::testRefreshGetToken
      /var/www/html/docroot/modules/oauth2_client/tests/src/Kernel/Oauth2ClientEntityKernelTest.php:207
    

    Investigating...

  • πŸ‡ΊπŸ‡ΈUnited States fathershawn New York

    The failing test is was for the upgrade from 3.x to 4.0. Although there are still 150 or so installs on that version, it's not possible to upgrade from 3.x to the release that this code will land on as 3.x only runs in D9. Removed the test. Corrected other lint detected.

  • πŸ‡ΊπŸ‡ΈUnited States fathershawn New York
  • πŸ‡ΊπŸ‡ΈUnited States fathershawn New York
  • πŸ‡ΊπŸ‡ΈUnited States fathershawn New York
Production build 0.71.5 2024