master
Richard van der Hoff 4 years ago
parent 9141db25aa
commit c272f2f075

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from pkg_resources import get_distribution, DistributionNotFound
from pkg_resources import DistributionNotFound, get_distribution
from matrix_synapse_saml_mozilla.mapping_provider import SamlMappingProvider
from matrix_synapse_saml_mozilla.username_picker import pick_username_resource

@ -13,11 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
import time
from typing import Optional
import attr
import time
SESSION_COOKIE_NAME = b"username_mapping_session"

@ -26,10 +26,10 @@ from synapse.api.errors import CodeMessageException
from synapse.module_api.errors import RedirectException
from matrix_synapse_saml_mozilla._sessions import (
SESSION_COOKIE_NAME,
UsernameMappingSession,
username_mapping_sessions,
expire_old_sessions,
SESSION_COOKIE_NAME,
username_mapping_sessions,
)
logger = logging.getLogger(__name__)

@ -28,9 +28,9 @@ from synapse.module_api import run_in_background
from synapse.module_api.errors import SynapseError
from matrix_synapse_saml_mozilla._sessions import (
SESSION_COOKIE_NAME,
get_mapping_session,
username_mapping_sessions,
SESSION_COOKIE_NAME,
)
"""

@ -1,4 +1,4 @@
from typing import Optional, Tuple
from typing import Optional
from matrix_synapse_saml_mozilla import SamlMappingProvider

@ -23,8 +23,10 @@ from saml2.config import SPConfig
from saml2.response import AuthnResponse
from saml2.sigver import security_context
from matrix_synapse_saml_mozilla._sessions import username_mapping_sessions
from synapse.api.errors import RedirectException
from matrix_synapse_saml_mozilla._sessions import username_mapping_sessions
from . import create_mapping_provider
logging.basicConfig()
@ -65,7 +67,7 @@ def _load_test_response() -> AuthnResponse:
class SamlUserAttributeTestCase(unittest.TestCase):
def test_get_remote_user_id_from_name_id(self):
resp = _load_test_response()
provider = create_mapping_provider({"use_name_id_for_remote_uid": True,})
provider = create_mapping_provider({"use_name_id_for_remote_uid": True})
remote_user_id = provider.get_remote_user_id(resp, "",)
self.assertEqual(remote_user_id, "test@domain.com")

Loading…
Cancel
Save