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

ModuleRouteListener won't Trigger MvcAuthEvents #10

Open
weierophinney opened this issue Dec 31, 2019 · 2 comments
Open

ModuleRouteListener won't Trigger MvcAuthEvents #10

weierophinney opened this issue Dec 31, 2019 · 2 comments

Comments

@weierophinney
Copy link
Contributor

Hi,

i have updated Apigility today and run in to this behaviour:

The oauth2 authentication rules did not work and everything was outside of authentication and served without checking if user has right Authorization header set.

What i found was that, whe i change this code in module/Application/Module.php

$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);

to

$mvcAuthEvent = new MvcAuthEvent($e, $serviceManager->get('authentication'), $serviceManager->get('authorization'));
$moduleRouteListener = new MvcRouteListener($mvcAuthEvent, $eventManager, $serviceManager->get('authentication'));
$moduleRouteListener->attach($eventManager);

everything is working again.
Was it intended to change it manually, so that you could use your own AuthListener or was it removed for ZF3 purpose?

I'm curious why nobody else was running into this...
And if it's not a bug, is it a valid approach to use the MvcAuthEvent like this?


Originally posted by @disasterdrop at zfcampus/zf-apigility-skeleton#127

@weierophinney
Copy link
Contributor Author

same problem here i updated 23/07

how u use $serviceManager


Originally posted by @Iraecio at zfcampus/zf-apigility-skeleton#127 (comment)

@weierophinney
Copy link
Contributor Author

@Iraecio
You can access the Service Manager over the MvcEvent with:
$serviceManager = $e->getApplication()->getServiceManager();


Originally posted by @disasterdrop at zfcampus/zf-apigility-skeleton#127 (comment)

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

No branches or pull requests

1 participant