Reintroduce the oauth2_grant_type_info info alter hook

Created on 21 February 2025, 5 months ago

Problem/Motivation

In the recent update of the oauth2_client module to version 4.x, the Oauth2GrantTypePluginManager hook ($this->alterInfo('oauth2_grant_type_info');) was removed. Our project, which involves a government implementation, requires slight customization's to the authorization_code grant type. Previously, we managed these customization's by extending the plugin and implementing the hook info alter. The removal of this hook now prevents us from overriding the authorization_code plugin as needed :(

PS: If you guys know any other way to change a plugin without reintroducing the alterinfo, please let me know.

Steps to reproduce

  1. Update the oauth2_client module to version 4.x.
  2. Attempt to override the authorization_code plugin by implementing custom alterations.
    Observe that the absence of $this->alterInfo('oauth2_grant_type_info'); makes it impossible to apply necessary customization's.

Proposed resolution

Reintroduce the $this->alterInfo('oauth2_grant_type_info'); in the Oauth2GrantTypePluginManager to allow for customization of grant types plugins. This would enable projects with specific requirements to extend and alter existing plugins without modifying the core module.

Remaining tasks

  • Discuss the solution of reintroducing the hook with the module maintainers.
  • Test the implementation once the alteration capabilities are reintroduced.

User interface changes

No user interface changes are expected.

API changes

Reintroducing the hook will allow developers to alter the grant type plugins, thus restoring backward-compatibility for those relying on this functionality for custom implementations.

Data model changes

No data model changes are expected.

πŸ“Œ Task
Status

Active

Version

4.1

Component

Code

Created by

πŸ‡§πŸ‡·Brazil murilohp

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

Merge Requests

Comments & Activities

  • Issue created by @murilohp
  • πŸ‡§πŸ‡·Brazil murilohp

    Just created a MR, moving to NR to see what you guys think about it. Besides, I'm attaching a patch to apply with the solution to be easier to apply on composer.

  • Pipeline finished with Success
    5 months ago
    Total: 150s
    #430790
  • πŸ‡ΊπŸ‡ΈUnited States fathershawn New York

    I'll have a look at the history of that class and get back to you.

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

    That alter hook was never present on a stable release. The grant workflows are specified in the Oauth2 standard, which is why I removed the hook as I was converting this system to a plugin. If you aren't comfortable putting what and why you need to alter a grant type, please DM me in Drupal Slack. Otherwise can you describe what it is that needs to be different and if that difference is supported by the Oauth2 standard but not by this module?

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

    There are a variety of ways that to customize aspects of the flow. If you don't want to post publicly what it is that you need to change, perhaps you could DM me in Drupal Slack.

Production build 0.71.5 2024