zf-fr / zfr-oauth2-server

PHP library for creating an OAuth 2 server (currently proof of concept)
BSD 3-Clause "New" or "Revised" License
36 stars 13 forks source link

Middleware addendum #38

Closed basz closed 8 years ago

basz commented 8 years ago

Hi @bakura10 we've talked briefly in a PR somewhere. Here is the result. My hope is you will merge it into the middleware branch on which i based it. It still needs some work, but I think most of the refactoring is done. Locally i can do a password grant request and I get a free token... yeah... all in an expressive app.

I left the configuration - but i believe wiring isn't supposed to be provided with these libraries (it is not a module).

Originally I worked on the zf2 module too, but I stopped with that for now (repo still there). I like the cleanness of this lib compared to some of the others. Hope it can evolve into supporting a oauth2 features. incl jwt.

well please let me know what you think, bas

bakura10 commented 8 years ago

Thanks a lot @basz !

Just a note for myself: continuing review tomorrow starting from TokenService.

After reading the first part, the only thing I'd like to change is the dependency to Doctrine. I know that @weierophinney would like to use maybe this library for Apigility 2, but Doctrine only is a blocker. Also, I'm using more and more DynamoDB without Doctrine, as I like the lightweight part of it, so I'd definitely want this library to be agnostic: only keeping the code here, maybe using only interfaces for the various repository, and have a Doctrine package that will make the bridge.

We'll need to see how this could be architectured but I'm pretty sure it would be possible.

@weierophinney, what is the expected min version for Apigility 2? I'd love to bump this library to PHP7, but I'd love you to use it for Apigility 2 as well...

bakura10 commented 8 years ago

Thanks!

So next work: removing all Doctrine dependencies. Using interfaces for repository. For existing factory, you can inject the interface like that:

$foo = $container->get(AccessTokenRepositoryInterface::class);

Then each module (like doctrine one) will simply add an alias to the interface to the concrete implementation :).