-
-
Notifications
You must be signed in to change notification settings - Fork 548
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
Pass "next" URL through SAML RelayState #851
Pass "next" URL through SAML RelayState #851
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #851 +/- ##
==========================================
+ Coverage 77.20% 77.27% +0.06%
==========================================
Files 339 339
Lines 10340 10380 +40
Branches 696 699 +3
==========================================
+ Hits 7983 8021 +38
- Misses 2200 2201 +1
- Partials 157 158 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
212a1ea
to
9e9df11
Compare
Looks good to me. Thanks! |
Almost all other arguments to `do_complete` were being passed to the backend, except for this. Without it, the backend cannot reliably access the redirect URL in the session state (which is useful if the backend wants to set the redirect URL, e.g. based on SAML RelayState).
This is the primary use case for RelayState, but the SAML backend did not previously support this use. Instead, it relied on the Strategy to store the "next" URL in session state and restore it from there after login. Unfortunately, in the case of SAML, this does not work if the server has set the session cookie's `SameSite` attribute to "Lax" or "Strict", as the SAML POST request from the IdP will not contain the session cookie. The new `RelayState` format (a JSON object) allows for further extensibility, as arbitrary additional fields can be added in the future.
9e9df11
to
b631796
Compare
Looks like I'm not authorized to merge this @digismack. |
@digismack, thanks for merging. Any idea when this will go out in a release? |
We need a new release soon to address #854, but it needs to be fixed first… |
Passing the "next" URL to redirect to after authentication completes is the primary use case for
RelayState
, but the SAML backend did not previously support this use. Instead, it relied on theStrategy
to store the "next" URL in session state and restore it from there after login. Unfortunately, in the case of SAML, this does not work if the server has set the session cookie'sSameSite
attribute to "Lax" or "Strict", as the SAML POST request from the IdP will not contain the session cookie.The new
RelayState
format (a JSON object) allows for further extensibility, as arbitrary additional fields can be added in the future.A number of additional SAML response test fixtures have been added - these differ only in the value of the
RelayState
parameter, and are used for testing different values (e.g. missing keys in the JSON).I've manually tested this with Okta and Django and the redirect works as intended (it previously did not).