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

Utils redirect returns a psr7 ResponseInterface #478

Open
wants to merge 3 commits into
base: 4.0.0
Choose a base branch
from

Conversation

Fredthelead
Copy link

Hi,

I'm using this library within a project that has psr7 request/response handling. The only problem is that this library redirects within the OneLogin\Saml2\Utils::redirect() method, which breaks the routing flow and bypasses my middlewares. If we simply make this method return a ResponseInterface instead of redirecting, this library becomes really simple to integrate with any project that uses psr7 request/response handling.

  • Replaced the redirect logic within this library
  • Updated demo1 and demo2 examples

Ref #162

@pitbulk
Copy link
Contributor

pitbulk commented Jun 4, 2021

Thanks for the effort to contribute this, there was an old ticket: #162 related to psr7, but it never was implemented.

The redirect method (as well as processSLO, login, logout, ) has a $stay parameter that will return the string instead of executing the redirection. I believe that you could use $stay=true instead in your project and then use the result on

return new \GuzzleHttp\Psr7\Response(302, ['location' => [(string) $url]]);

Instead of requiring

"guzzlehttp/guzzle": "^7.3",

I believe you could include it on require-dev, as gonna be used on an example, and then provide a demo3, that will have your demo using psr7 way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants