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

logout request ends up in AttributeError #259

Closed
spaceone opened this issue Sep 28, 2015 · 4 comments
Closed

logout request ends up in AttributeError #259

spaceone opened this issue Sep 28, 2015 · 4 comments

Comments

@spaceone
Copy link
Contributor

Traceback:

    self.sp.parse_logout_request_response(message, binding)
  File "/usr/lib/python2.7/dist-packages/saml2/entity.py", line 962, in parse_logout_request_response
    "single_logout_service", binding)
  File "/usr/lib/python2.7/dist-packages/saml2/entity.py", line 949, in _parse_response
    response = response.verify(key_file)
  File "/usr/lib/python2.7/dist-packages/saml2/response.py", line 400, in verify
    return self._verify()
  File "/usr/lib/python2.7/dist-packages/saml2/response.py", line 376, in _verify
    assert self.response.version == "2.0"
AttributeError: 'NoneType' object has no attribute 'version'

The SAML message:

zlib.decompress('''lVJda9wwEPwrxu93XsuWbYk7Q+AoHKRJ2wt96MuxllaNiS25lgz5+fVHD9JQAn0To52Znd09eOy7Qd67n24K3+jXRD5Er31nvVx/jvE0WunQt15a7MnLoOTl7vO9ZHuQw+iCU66L31A+ZqD3NIbW2Tg6n47xVYBRUApeGsE1plmVM055SSmSFibXoA1LMwDScfSdRj8zj/EsNNO9n+hsfUAbZghSvgOxY9UTCJlzyfIfcXSa07QWw8p6DmHwMkkaVC/TwIHtNaHunHrhsG9tGNFSSKZeDcmSI/GdS+LowYVH+zjemUDjexsOq019WOrl2tBY32x69DOFQ/pPG9/2Q0friJ83P5a0ekh6Cqgx4H6GD8lb3c3kYZ7o+RRdviyPrxN2rWmXxv433M0njj65scfw8dYWpNU7s5bKRcy3ZENcXzk0BpsGeFoVhukyy3JdIUuhAqTCFDkIzQqdkfiTZguwpRnkhfyy0rPV9FpfmWDEFZalMUrzklTWCKMZI1MAV6DyzJQmh7TJN7F3/Bv41zHXvwE='''.decode('base64'), -15)
@spaceone
Copy link
Contributor Author

I found out the reason! If the SP is configured to only accept signed logout responses and the response is not signed the error happens.
PR is here: #277

@spaceone
Copy link
Contributor Author

Hi Roland! The SLO services from the examples aren't handling samlp:LogoutRequest requests (it handles only <samlp:LogoutResponse). Can you give me a small example how I can handle one? Maybe there is also a function which differentiate this case?

@spaceone
Copy link
Contributor Author

My workaround currently looks like this:

try:
    is_logout_request = 'LogoutRequest' in zlib.decompress(message.decode('base64'), -15).split('>', 1)[0]
except:   # TODO: parse the XML correctly
    is_logout_request = False

if is_logout_request:
    self.sp.parse_logout_request(message, binding)
else:
    self.sp.parse_logout_request_response(message, binding)

rohe pushed a commit that referenced this issue Nov 1, 2015
fix reraising of exception (Issue #259)
@jkakavas
Copy link
Member

This is fixed in #277

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

2 participants