markitosgv / JWTRefreshTokenBundle

Implements a Refresh Token system over Json Web Tokens in Symfony
MIT License
649 stars 159 forks source link

Refresh Token with PDO ? #384

Open Zhaerius opened 1 month ago

Zhaerius commented 1 month ago

Hi

I want to implement the refresh token, but I don't use doctrine, just a repository layer that accesses the database with PDO.

The documentation is not very clear on this, there seems to be a way, I have to make a manager object ? Concretely it is a class that will inherit from what exactly ?

Then I will just have to give this class in the yaml instead of the manager_object ?

Thanks in advance

mbabker commented 1 month ago

You're going to need a compiler pass to change services from this bundle to point to your implementations (i.e. the gesdinet.jwtrefreshtoken.refresh_token_manager service points to the Gesdinet\JWTRefreshTokenBundle\Doctrine\RefreshTokenManager class which has a hard requirement for a Doctrine object manager) as the bundle assumes there will be a Doctrine integration available.

You'll need your own Gesdinet\JWTRefreshTokenBundle\Model\RefreshTokenManagerInterface and Gesdinet\JWTRefreshTokenBundle\Model\RefreshTokenInterface implementations (though for the model itself, you can most likely just safely use the empty Gesdinet\JWTRefreshTokenBundle\Entity\RefreshToken for this, the model classes themselves aren't tied to Doctrine in any way since standalone XML mappings are used).

And I think that realistically should be the biggest things to look at. IIRC the bundle config won't hard fail out if a Doctrine integration isn't in place other than the default manager service being invalid, everything that has a requirement to one of the object managers is contained within that service.