laravel-saml2
laravel-saml2 copied to clipboard
ReflectionException (-1) "Class does not exist"
laravel-saml2 : 2.0.0 Laravel 5.8
After initial install and config for the 'test' idp. I tried http://127.0.0.1:8000/saml2/test/metadata
and received the error in the title.
In the saml2_settings.php file the following is set as default
* (Optiona) Which class implements the route functions.
* If left blank, defaults to this lib's controller (Aacotroneo\Saml2\Http\Controllers\Saml2Controller).
* If you need to extend Saml2Controller (e.g. to override the `login()` function to pass
* a `$returnTo` argument), this value allows you to pass your own controller, and have
* it used in the routes definition.
*/
'saml2_controller' => '',
If you notice, and this took me a while to see it, there is an extra space in the error message.
"Class does not exist"
I believe that the controller in the vendor files is not being used.
When I did this 'saml2_controller' => 'Aacotroneo\Saml2\Http\Controllers\Saml2Controller',
to explicitly use the vendor...src\ file then the route metatdata worked and produced metadata.
So it appears that the default, as the config states, is not being used in replacing the empty config file string.
I'm getting the same error but your fix does not work for me.
I'm using:
'saml2_controller' => 'vendor/aacotroneo/laravel-saml2/src/Aacotroneo/Saml2/Http/Controllers/Saml2Controller'
,
@lloydie-t : For me it also worked to just comment it out:
// 'saml2_controller' => '',
@lloydie-t
According to the readme you should be passing your controller's fully qualified namespace:
'saml2_controller' => 'App\Http\Controllers\MyNamespace\MySaml2Controller'
not a file reference.
so, in my specific usecase, I had a controller file /app/Http/Controllers/CustomAuth/SabaAuth.php
that had a namespace of App\Http\Controllers\CustomAuth\SabaAuth
So my setting is:
'saml2_controller' => 'App\Http\Controllers\CustomAuth\SabaAuth',
And it works perfectly.
+1 to @xnasa for opening this, as the default beahvior of blank will cause this error out of the box.
@xnasa I am using 'saml2_controller' => 'Aacotroneo\Saml2\Http\Controllers\Saml2Controller', but still getting same error..
@xnasa I am using 'saml2_controller' => 'Aacotroneo\Saml2\Http\Controllers\Saml2Controller', but still getting same error..
Above issue has been fixed on server but still on my local system.
getting new issue Route [saml_login] not defined. (View: C:\xampp\htdocs\cfxproduct\resources\views\auth\login.blade.php)
i got Class saml does not exist it was because i forgot to add saml to the $middlewareGroups in Kernel.php