Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom persistence managers #171

Merged

Conversation

frankdekker
Copy link
Contributor

@frankdekker frankdekker commented Nov 25, 2023

Added support for configuring custom persistence manager.
As improvement implementation on #145

Configuration:

league_oauth2_server:
    persistence:
        custom:
            access_token_manager: App\Manager\MyAccessTokenManager
            authorization_code_manager: App\Manager\MyAuthorizationCodeManager
            client_manager: App\Manager\MyClientManager
            refresh_token_manager: App\Manager\MyRefreshTokenManager
            credentials_revoker: App\Service\MyCredentialsRevoker

Code changes:

  • Extended the Configuration class.
  • Added support in the Extension class.
  • Skipped the doctrine extension check if in_memory or custom persistence is chosen.
  • Added acceptance test, testing the different auth flows.
  • Updated the readme.md to include instructions how to set the custom persistence managers.

Implementation notes
I would've really liked to make doctrine/orm not a mandatory dependency but move it to the suggests section in composer.json. We have a project where we can't use Doctrine, and need to implement our own persistence manager, but now 6-7 doctrine packages will be included in the project. Could we move doctrine/orm to suggests section in a future version?

@Nattfarinn
Copy link
Contributor

You probably will have to add support for https://github.com/thephpleague/oauth2-server-bundle/blob/master/src/Service/CredentialsRevokerInterface.php as its implementation also relies on ORM ("been there, done that"). I like your approach more, even if is a bit more invasive.

@frankdekker
Copy link
Contributor Author

You probably will have to add support for https://github.com/thephpleague/oauth2-server-bundle/blob/master/src/Service/CredentialsRevokerInterface.php as its implementation also relies on ORM ("been there, done that"). I like your approach more, even if is a bit more invasive.

Thanks, i've added support for the credentials revoker :).

@chalasr chalasr force-pushed the Allow-custom-persistence-managers branch 2 times, most recently from 1bea6ec to 9850d82 Compare March 10, 2024 21:34
@chalasr chalasr force-pushed the Allow-custom-persistence-managers branch from 40a37f2 to 81a32a0 Compare March 10, 2024 21:45
@chalasr
Copy link
Member

chalasr commented Mar 10, 2024

It took time, but here we go, this is in now. Thank you very much @frankdekker.

@chalasr chalasr merged commit e4d5221 into thephpleague:master Mar 10, 2024
9 of 10 checks passed
@frankdekker frankdekker deleted the Allow-custom-persistence-managers branch March 11, 2024 07:36
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.

3 participants