summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.rst4
-rw-r--r--src/saml2/client.py11
-rw-r--r--tests/test_60_sp.py5
3 files changed, 14 insertions, 6 deletions
diff --git a/README.rst b/README.rst
index d67d980f..4aea93d3 100644
--- a/README.rst
+++ b/README.rst
@@ -5,8 +5,8 @@ PySAML2 - SAML2 in Python
:Version: see VERSION_
:Documentation: https://pysaml2.readthedocs.io/
-.. image:: https://api.travis-ci.org/IdentityPython/pysaml2.png?branch=master
- :target: https://travis-ci.org/IdentityPython/pysaml2
+.. image:: https://api.travis-ci.com/IdentityPython/pysaml2.png?branch=master
+ :target: https://travis-ci.com/IdentityPython/pysaml2
.. image:: https://img.shields.io/pypi/pyversions/pysaml2.svg
:target: https://pypi.org/project/pysaml2/
diff --git a/src/saml2/client.py b/src/saml2/client.py
index cf0399f3..fe4b20cc 100644
--- a/src/saml2/client.py
+++ b/src/saml2/client.py
@@ -251,6 +251,11 @@ class Saml2Client(Base):
not_done = entity_ids[:]
responses = {}
+ if expected_binding is None:
+ expected_binding = next(
+ iter(self.config.preferred_binding["single_logout_service"]),
+ None,
+ )
for entity_id in entity_ids:
logger.debug("Logout from '%s'", entity_id)
# for all where I can use the SOAP binding, do those first
@@ -281,8 +286,10 @@ class Saml2Client(Base):
session_indexes = None
sign = sign if sign is not None else self.logout_requests_signed
- sign_post = False if binding == BINDING_HTTP_REDIRECT else sign
- sign_redirect = False if binding == BINDING_HTTP_POST and sign else sign
+ sign_post = sign and (
+ binding == BINDING_HTTP_POST or binding == BINDING_SOAP
+ )
+ sign_redirect = sign and binding == BINDING_HTTP_REDIRECT
req_id, request = self.create_logout_request(
destination,
diff --git a/tests/test_60_sp.py b/tests/test_60_sp.py
index 78e88400..b1eaa7c6 100644
--- a/tests/test_60_sp.py
+++ b/tests/test_60_sp.py
@@ -1,7 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-import base64
+from base64 import encodebytes as b64encode
+
import pytest
from saml2.authn_context import INTERNETPROTOCOLPASSWORD
from saml2.saml import NAMEID_FORMAT_TRANSIENT
@@ -73,7 +74,7 @@ class TestSP():
"urn:mace:example.com:saml:roland:sp", trans_name_policy,
"foba0001@example.com", authn=AUTHN)
- resp_str = base64.encodestring(resp_str.encode('utf-8'))
+ resp_str = b64encode(resp_str.encode('utf-8'))
self.sp.outstanding_queries = {"id1": "http://www.example.com/service"}
session_info = self.sp._eval_authn_response(
{}, {"SAMLResponse": [resp_str]})