-
-
Notifications
You must be signed in to change notification settings - Fork 309
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
RelayState Should Not Be Required in Request #70
Comments
So your patch is at login method replace
by
right? |
Not quite. I don't think RelayState should be set at all if if return_to is not None:
parameters['RelayState'] = return_to (without the |
But that change can break current environments that uses that toolkit and expect that behavior. |
After giving it some thought, would it be acceptable to omit the RelayState if This would allow the default if return_to is None:
parameters['RelayState'] = OneLogin_Saml2_Utils.get_self_url_no_query()
elif return_to is not '':
parameters['RelayState'] = return_to Something like that? Short of adding a new advanced settings flag to control this, I can't think of a better way to explicitly omit the RelayState from the request. For my use case I've taken to scrubbing the RelayState from the request after it's returned from the OneLogin_SAML2_Auth client: def remove_relay_state(url):
"""Removes the RelayState parameter from a SAML login request."""
if 'RelayState' not in url:
return url
# Parse and modify the query parameters
parts = urlparse(url)
params = parse_qs(parts.query)
del params['RelayState']
# Reconstruct the URL
query = urlencode(params, doseq=True)
new_url = urlunparse((
parts.scheme,
parts.netloc,
parts.path,
parts.params,
query,
None, # No fragments
))
return new_url But that's addressing the symptoms, not the problem. |
According to the SAML Profile for Single Sign-On AuthnRequests, the Service Provider MAY send a
RelayState
along with the request, but that it's not required. See section 4.1.3.1 of this document:https://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf
However, in
OneLogin_Saml2_Auth.login()
(in auth.py) this parameter is always set, even ifreturn_to
is a blank string. For example, aredirect_url
returned bylogin()
could look like:This could potentially be misleading for Identity Providers that detect the
RelayState
parameter in the request only to discover that it's blank.I propose that the
RelayState
parameter should not be set at all ifreturn_to
isNone
, or an empty string (''
). If you think that's a reasonable fix, I'll create a PR for you. 🙂The text was updated successfully, but these errors were encountered: