lightSAML/SpBundle

Unable to find the controller for path "/saml/login_check". The route is wrongly configured.

gavinjackson opened this issue · 4 comments

Hi guys,

I've spent a few days trying to get spbundle working in a symfony 4.4.3 application.

I followed the installation instructions carefully, a think the doco might be for an earlier version of symfony (I modified a few things eg. App rather than AppBundle, Entities placed in App/Entities.

Entities generated (output below)
Services are registered (output below)
Routes are confingured
IDP/SP metadata generated and exchanged (I'm using a simplesamlphp IDP)

I can access the SP metadata via:
http://localhost/saml/metadata.xml

I can initiate the SAML login process by visiting:
http://localhost/saml/login

It redirects to the IDP, prompts for a username and password and then presents the following error:

NotFoundHttpException

Symfony\Component\HttpKernel\Exception\NotFoundHttpException: Unable to find the controller > for path "/saml/login_check". The route is wrongly configured.

php .\bin\console debug:router --show-controllers

Name Method Scheme Host Path Controller

_preview_error ANY ANY ANY /_error/{code}.{_format} error_controller::preview()
_wdt ANY ANY ANY /_wdt/{token} web_profiler.controller.profiler::toolbarAction()
_profiler_home ANY ANY ANY /_profiler/
web_profiler.controller.profiler::homeAction()
_profiler_search ANY ANY ANY /_profiler/search web_profiler.controller.profiler::searchAction()
_profiler_search_bar ANY ANY ANY /_profiler/search_bar web_profiler.controller.profiler::searchBarAction()
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
web_profiler.controller.profiler::phpinfoAction()
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
web_profiler.controller.profiler::searchResultsAction()
_profiler_open_file ANY ANY ANY /_profiler/open
web_profiler.controller.profiler::openAction()
_profiler ANY ANY ANY /_profiler/{token}
web_profiler.controller.profiler::panelAction()
_profiler_router ANY ANY ANY /_profiler/{token}/router
web_profiler.controller.router::panelAction()
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
web_profiler.controller.exception_panel::body()
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
web_profiler.controller.exception_panel::stylesheet()
homepage ANY ANY ANY / App\Controller\DefaultController::indexAction()
secure ANY ANY ANY /secure App\Controller\DefaultController::secureAction()
lightsaml_sp.metadata ANY ANY ANY /saml/metadata.xml
LightSaml\SpBundle\Controller\DefaultController::metadataAction()
lightsaml_sp.discovery ANY ANY ANY /saml/discovery
LightSaml\SpBundle\Controller\DefaultController::discoveryAction()
lightsaml_sp.login ANY ANY ANY /saml/login
LightSaml\SpBundle\Controller\DefaultController::loginAction()
lightsaml_sp.login_check ANY ANY ANY /saml/login_check
lightsaml_sp.sessions ANY ANY ANY /saml/sessions
LightSaml\SpBundle\Controller\DefaultController::sessionsAction()
logout ANY ANY ANY /logout
(Note that no controller is registered against the lighsaml_sp.login_check route).

php .\bin\console debug:container

Service ID Class name

...
App\Security\User\UserCreator App\Security\User\UserCreator
App\Store\IdStore App\Store\IdStore
user_creator App\Security\User\UserCreator
id_store App\Store\IdStore
...

Here are the server logs following the login process:

[2020-01-28 04:06:48] request.INFO: Matched route "lightsaml_sp.login {"route":"lightsaml_sp.login","route_parameters":{"_route":"lightsaml_sp.login","_controller":"LightSaml\SpBundle\Controller\DefaultController::loginAction"},"request_uri":"http://localhost/saml/login","method":"GET"} []
[2020-01-28 04:06:48] php.INFO: User Deprecated: The "LightSaml\SpBundle\Controller\DefaultController" class extends "Symfony\Bundle\FrameworkBundle\Controller\Controller" that is deprecated since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: The "LightSaml\SpBundle\Controller\DefaultController" class extends "Symfony\Bundle\FrameworkBundle\Controller\Controller" that is deprecated since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead. at C:\Users\gavinj\Documents\GitHub\lmap-autoship\autoship\vendor\symfony\error-handler\DebugClassLoader.php:378)"} []
[2020-01-28 04:06:48] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2020-01-28 04:06:48] request.INFO: Matched route "lightsaml_sp.discovery". {"route":"lightsaml_sp.discovery","route_parameters":{"_route":"lightsaml_sp.discovery","_controller":"LightSaml\SpBundle\Controller\DefaultController::discoveryAction"},"request_uri":"http://localhost/saml/discovery","method":"GET"} []
[2020-01-28 04:06:48] php.INFO: User Deprecated: The "LightSaml\SpBundle\Controller\DefaultController" class extends "Symfony\Bundle\FrameworkBundle\Controller\Controller" that is deprecated since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: The "LightSaml\SpBundle\Controller\DefaultController" class extends "Symfony\Bundle\FrameworkBundle\Controller\Controller" that is deprecated since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead. at C:\Users\gavinj\Documents\GitHub\lmap-autoship\autoship\vendor\symfony\error-handler\DebugClassLoader.php:378)"} []
[2020-01-28 04:06:48] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2020-01-28 04:06:48] request.INFO: Matched route "lightsaml_sp.login". {"route":"lightsaml_sp.login","route_parameters":{"_route":"lightsaml_sp.login","_controller":"LightSaml\SpBundle\Controller\DefaultController::loginAction"},"request_uri":"http://localhost/saml/login?idp=http%3A%2F%2Flocalhost%2Fsimplesaml_idp%2Fsaml2%2Fidp%2Fmetadata.php","method":"GET"} []
[2020-01-28 04:06:49] php.INFO: User Deprecated: The "LightSaml\SpBundle\Controller\DefaultController" class extends "Symfony\Bundle\FrameworkBundle\Controller\Controller" that is deprecated since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: The "LightSaml\SpBundle\Controller\DefaultController" class extends "Symfony\Bundle\FrameworkBundle\Controller\Controller" that is deprecated since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead. at C:\Users\gavinj\Documents\GitHub\lmap-autoship\autoship\vendor\symfony\error-handler\DebugClassLoader.php:378)"} []
[2020-01-28 04:06:49] php.INFO: User Deprecated: Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead. at C:\Users\gavinj\Documents\GitHub\lmap-autoship\autoship\vendor\symfony\event-dispatcher\EventDispatcher.php:58)"} []
[2020-01-28 04:06:49] php.INFO: User Deprecated: Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead. at C:\Users\gavinj\Documents\GitHub\lmap-autoship\autoship\vendor\symfony\event-dispatcher\EventDispatcher.php:58)"} []
[2020-01-28 04:06:49] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2020-01-28 04:06:55] request.INFO: Matched route "lightsaml_sp.login". {"route":"lightsaml_sp.login","route_parameters":{"_controller":"Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction","path":"/saml/login","permanent":true,"scheme":null,"httpPort":80,"httpsPort":443,"_route":"lightsaml_sp.login"},"request_uri":"http://localhost/saml/login/","method":"GET"} []
[2020-01-28 04:06:55] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2020-01-28 04:07:07] request.INFO: Matched route "lightsaml_sp.login_check". {"route":"lightsaml_sp.login_check","route_parameters":{"_route":"lightsaml_sp.login_check"},"request_uri":"http://localhost/saml/login_check","method":"POST"} []
[2020-01-28 04:07:07] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2020-01-28 04:07:07] request.WARNING: Unable to look for the controller as the "_controller" parameter is missing. [] []
[2020-01-28 04:07:07] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "Unable to find the controller for path "/saml/login_check". The route is wrongly configured." at C:\Users\gavinj\Documents\GitHub\lmap-autoship\autoship\vendor\symfony\http-kernel\HttpKernel.php line 130 {"exception":"[object] (Symfony\Component\HttpKernel\Exception\NotFoundHttpException(code: 0): Unable to find the controller for path "/saml/login_check". The route is wrongly configured. at C:\Users\gavinj\Documents\GitHub\lmap-autoship\autoship\vendor\symfony\http-kernel\HttpKernel.php:130)"} []
[2020-01-28 04:07:07] request.INFO: Matched route "_wdt". {"route":"_wdt","route_parameters":{"_route":"_wdt","_controller":"web_profiler.controller.profiler::toolbarAction","token":"eedaaf"},"request_uri":"http://localhost/_wdt/eedaaf","method":"GET"} []

Your help would be greatly appreciated!

Cheers,
Gav

Hi @gavinjackson
Did you manage to find a solution for this? If you did, please let me know.

Thanks

I'm facing the same problem.

Do you have a solution @gavinjackson @luismilanese ?

Thanks

I'm facing the same problem.

Do you have a solution @gavinjackson @luismilanese ?

Thanks

No, I don't, @erichard
As a matter of fact, I quit this lib altogether and went on with hslavich/oneloginsaml-bundle which is way easier and its documentation makes more sense.

I found a solution in a closed issue. In fact I had a conflict between firewall. The url /saml/login_check was captured by a firewall with security: false.

Fixed for me. I think this issue could be fixed as well.