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

Error message shown when IDP response validation is invalid is a Symfony TypeError instead of the real error #63

Open
KenKodz opened this issue Apr 12, 2023 · 3 comments

Comments

@KenKodz
Copy link

KenKodz commented Apr 12, 2023

Below is the error that is returned when the response from the IDP is determined to be invalid.

Symfony\Component\HttpFoundation\Response::setContent(): Argument #1 ($content) must be of type ?string, Illuminate\Routing\Redirector given, called in \vendor\laravel\framework\src\Illuminate\Http\Response.php on line 72

I came across this when I missed copying part of the IDP cert into idp_x509_cert.

I'm not sure this can be fixed in this package as it seems to be a Laravel issue, but I thought I'd put it here in case someone could figure out something. Worst case scenario, someone else who can't properly copy/paste (like me today) can fix the issue faster.

Currently using Laravel 10.7.1 and laravel-saml2 2.2.0

@nspaul
Copy link

nspaul commented May 15, 2023

@KenKodz I am seeing this same error while trying to set this up. I have double-checked my IDP cert in the tenant configuration, and it is correct. Can you expand on what you did to fix this? Are there any good tricks to help troubleshoot this?

FWIW, I also manually changed the tenant's uuid to the same value as key so that my login URL would stay the same. I am trying to migrate over from aacotroneo/laravel-saml2. I don't know if that has any direct effect on this specific error, but I though I should probably provide that info here for full context.
I referenced this situation here: #66

@KenKodz
Copy link
Author

KenKodz commented May 15, 2023

Basically, in my case, there was an error with the key exchange between my SP and IDP. This returns a error and tries to redirect to somewhere (didn't try to figure out where). This redirect causes the exception to be thrown.

The way I figured it out is totally the wrong way to do it, but it worked for me. I used dd() in the package code until I was able to figure out where in the code it was failing. It felt dirty, but it worked. LOL

@jamesratcliffe
Copy link

jamesratcliffe commented May 24, 2023

It looks like you need to specify a route to handle the error.

The Saml2Controller redirect if there's a SAML2 error:

return redirect(config('saml2.errorRoute'));

You have to set the SAML2_ERROR_URL env variable or update the published config file The SAML2 error is flashed to the session, so you won't see it unless the view renders them.

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

3 participants