TokenController.php and RouteController.php have the same route annotation
Hi @bshaffer,
When testing the resource endpoint
curl -u testclient:testpass https://serverIP/Symfony-OAuth-Server/web/app_dev.php/resource -k -d 'access_token=YOUR_TOKEN'
the TokenController gets executed instead of the ResourceController.
It is due to the fact that the ResourceController and TokenController have exactly the same route annotation. ResourceController should have the route e.g. @Route("/resource", name="_resource") instead of @Route("/token", name="_token").
After modifying the route the following error is raised:
CRITICAL - Uncaught PHP Exception ReflectionException: "Class OAuth2\ServerBundle\Controller\Application does not exist" at /var/www/Symfony-OAuth-Server/app/cache/dev/classes.php line 5997
Here is the full stack trace:
in /var/www/Symfony-OAuth-Server/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ParamConverterListener.php line 81
at ReflectionParameter->getClass()
in /var/www/Symfony-OAuth-Server/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ParamConverterListener.php line 81
at Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener->autoConfigure(object(ReflectionMethod), object(Request), array())
in /var/www/Symfony-OAuth-Server/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/EventListener/ParamConverterListener.php line 72
at Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener->onKernelController(object(FilterControllerEvent), 'kernel.controller', object(ContainerAwareEventDispatcher))
in line
at call_user_func(array(object(ParamConverterListener), 'onKernelController'), object(FilterControllerEvent), 'kernel.controller', object(ContainerAwareEventDispatcher))
in /var/www/Symfony-OAuth-Server/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php line 59
at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(FilterControllerEvent), 'kernel.controller', object(ContainerAwareEventDispatcher))
in line
at call_user_func(object(WrappedListener), object(FilterControllerEvent), 'kernel.controller', object(ContainerAwareEventDispatcher))
in /var/www/Symfony-OAuth-Server/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 164
at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.controller', object(FilterControllerEvent))
in /var/www/Symfony-OAuth-Server/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 53
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.controller', object(FilterControllerEvent))
in /var/www/Symfony-OAuth-Server/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php line 167
at Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.controller', object(FilterControllerEvent))
in /var/www/Symfony-OAuth-Server/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php line 112
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch('kernel.controller', object(FilterControllerEvent))
in /var/www/Symfony-OAuth-Server/app/bootstrap.php.cache line 2971
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in /var/www/Symfony-OAuth-Server/app/bootstrap.php.cache line 2936
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in /var/www/Symfony-OAuth-Server/app/bootstrap.php.cache line 3085
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in /var/www/Symfony-OAuth-Server/app/bootstrap.php.cache line 2335
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in /var/www/Symfony-OAuth-Server/web/app_dev.php line 28
Thanks for pointing this out... that Controller shouldn't even exist, and doesn't make sense to include in this library (as you can see, the data returned is static. This method should be defined for the APIs of your project, and not through this library)
fixed in e304ee7a0f35662aa20bac9a94e71ac5b00dac22 - ResourceController removed