Comments (5)
My code editor also doesn't agree on a closure being returned by ServiceManager
:)
I get big fat red lines under my DefaultAuthenticationListenerFactory
class.
Deep down in the ZF2 ServiceLocatorInterface
the return values from a service manager should be either an object or an array:
/**
* Retrieve a registered instance
*
* @param string $name
* @throws Exception\ServiceNotFoundException
* @return object|array
*/
public function get($name);
In the ZF\MvcAuth\Factory\DefaultAuthenticationListenerFactory
the following is done:
return new OAuth2Adapter($factory());
(https://github.com/zfcampus/zf-mvc-auth/blob/master/src/Factory/DefaultAuthenticationListenerFactory.php#L105)
That is why I get the following error comment:
Function name must be callable - a string, Closure or class implementing _invoke, currently array |object
I also get an error here
return new OAuth2Adapter($serverFactory(null));
(https://github.com/zfcampus/zf-mvc-auth/blob/master/src/Factory/DefaultAuthenticationListenerFactory.php#L128)
Since the php doc is not correct it looks like we are instantiating OAuth2\Server
class here which is not possible.
I think it would be better to return the OAuth2\Server
instead of the factory here or at least make sure all documentation is up to date so that it makes sense to my SDK.
I can make a PR if necessary.
Originally posted by @Wilt at zfcampus/zf-oauth2#114 (comment)
from api-tools-oauth2.
@Wilt PR ? :)
Originally posted by @jguittard at zfcampus/zf-oauth2#114 (comment)
from api-tools-oauth2.
@jguittard I was awaiting response from someone working on this repository to get some feedback on how to improve this...
@weierophinney Do you have time to take a quick look and make a suggestion on how to deal with this in a PR?
IMHO it would be good if this essential part of the zf-mvc-auth module becomes a bit more readable/understandable... All these $factory
calls inside other factories are a bit ambiguous. As I mentioned before my code editor also doesn't agree with it:
Originally posted by @Wilt at zfcampus/zf-oauth2#114 (comment)
from api-tools-oauth2.
@Wilt This was done due to issues with the design of oauth2-server. Essentially, the OAuth2\Server
instance does work on initialization that can lead to issues with the HTTP request, database connections, and more. We had to provide a way to lazy-load it to solve the problems.
We can maybe solve the IDE issues with typehints, and some of these may be solved now (I did some work on the AuthControllerFactory
earlier today). But I'm not sure we can make any other changes unless we change out the oauth2 server infrastructure or get changes pushed upstream to oauth2-server-php.
Originally posted by @weierophinney at zfcampus/zf-oauth2#114 (comment)
from api-tools-oauth2.
@weierophinney Thanks for the explanation.
Would it be possible to use a lazy services pattern (using delegators) for this instead of this invokable factory? Or is this not sufficient to solve those issues you refer to?
Originally posted by @Wilt at zfcampus/zf-oauth2#114 (comment)
from api-tools-oauth2.
Related Issues (20)
- No Authorization Events Fired on Token Request
- Tables DDL doesnt match original HOT 1
- Question on protecting an API using AbstractRestfulController with OAuth2 HOT 3
- New adapter with "." error HOT 1
- Dist package 1.1.2 has two src folders HOT 4
- Clicking NO does not render error HOT 3
- Wrong response format HOT 1
- Username and password access HOT 3
- OAuth2 Request & Response are not extendable HOT 1
- Psalm integration
- PHP 8.0 support
- Switch to GHA CI workflow
- Switch to GHA CI workflow
- Class 'Webmozart\Assert\Assert' not found
- BcryptTrait.php checkpassword() should accept array, but no longer does
- doctrine configuration HOT 1
- An error occurred during execution
- Redirect if user is not authenticated HOT 1
- remove NOT NULL for client_secret
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api-tools-oauth2.