|
|
@ -20,7 +20,7 @@ import unittest
|
|
|
|
import pkg_resources
|
|
|
|
import pkg_resources
|
|
|
|
from saml2.config import SPConfig
|
|
|
|
from saml2.config import SPConfig
|
|
|
|
from saml2.response import AuthnResponse
|
|
|
|
from saml2.response import AuthnResponse
|
|
|
|
from saml2.sigver import security_context
|
|
|
|
from saml2.sigver import CryptoBackend, SecurityContext
|
|
|
|
|
|
|
|
|
|
|
|
from synapse.api.errors import RedirectException
|
|
|
|
from synapse.api.errors import RedirectException
|
|
|
|
|
|
|
|
|
|
|
@ -39,6 +39,10 @@ class FakeResponse:
|
|
|
|
self.ava["displayName"] = [display_name]
|
|
|
|
self.ava["displayName"] = [display_name]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class FakeCryptoBackend(CryptoBackend):
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _load_test_response() -> AuthnResponse:
|
|
|
|
def _load_test_response() -> AuthnResponse:
|
|
|
|
response_xml = pkg_resources.resource_string(
|
|
|
|
response_xml = pkg_resources.resource_string(
|
|
|
|
"tests", "test_saml_response.xml"
|
|
|
|
"tests", "test_saml_response.xml"
|
|
|
@ -49,7 +53,7 @@ def _load_test_response() -> AuthnResponse:
|
|
|
|
assert config.attribute_converters is not None
|
|
|
|
assert config.attribute_converters is not None
|
|
|
|
|
|
|
|
|
|
|
|
response = AuthnResponse(
|
|
|
|
response = AuthnResponse(
|
|
|
|
sec_context=security_context(config),
|
|
|
|
sec_context=SecurityContext(FakeCryptoBackend()),
|
|
|
|
attribute_converters=config.attribute_converters,
|
|
|
|
attribute_converters=config.attribute_converters,
|
|
|
|
entity_id="https://host/_matrix/saml2/metadata.xml",
|
|
|
|
entity_id="https://host/_matrix/saml2/metadata.xml",
|
|
|
|
allow_unsolicited=True,
|
|
|
|
allow_unsolicited=True,
|
|
|
|