@@ -445,26 +445,9 @@ def test_get_login_flows(self):
445445 [f ["type" ] for f in channel .json_body ["flows" ]], expected_flow_types
446446 )
447447
448- @override_config ({"experimental_features" : {"msc2858_enabled" : True }})
449- def test_get_msc2858_login_flows (self ):
450- """The SSO flow should include IdP info if MSC2858 is enabled"""
451- channel = self .make_request ("GET" , "/_matrix/client/r0/login" )
452- self .assertEqual (channel .code , 200 , channel .result )
453-
454- # stick the flows results in a dict by type
455- flow_results : Dict [str , Any ] = {}
456- for f in channel .json_body ["flows" ]:
457- flow_type = f ["type" ]
458- self .assertNotIn (
459- flow_type , flow_results , "duplicate flow type %s" % (flow_type ,)
460- )
461- flow_results [flow_type ] = f
462-
463- self .assertIn ("m.login.sso" , flow_results , "m.login.sso was not returned" )
464- sso_flow = flow_results .pop ("m.login.sso" )
465- # we should have a set of IdPs
448+ flows = {flow ["type" ]: flow for flow in channel .json_body ["flows" ]}
466449 self .assertCountEqual (
467- sso_flow [ "org.matrix.msc2858. identity_providers" ],
450+ flows [ "m.login.sso" ][ " identity_providers" ],
468451 [
469452 {"id" : "cas" , "name" : "CAS" },
470453 {"id" : "saml" , "name" : "SAML" },
@@ -473,19 +456,10 @@ def test_get_msc2858_login_flows(self):
473456 ],
474457 )
475458
476- # the rest of the flows are simple
477- expected_flows = [
478- {"type" : "m.login.cas" },
479- {"type" : "m.login.token" },
480- {"type" : "m.login.password" },
481- ] + ADDITIONAL_LOGIN_FLOWS
482-
483- self .assertCountEqual (flow_results .values (), expected_flows )
484-
485459 def test_multi_sso_redirect (self ):
486460 """/login/sso/redirect should redirect to an identity picker"""
487461 # first hit the redirect url, which should redirect to our idp picker
488- channel = self ._make_sso_redirect_request (False , None )
462+ channel = self ._make_sso_redirect_request (None )
489463 self .assertEqual (channel .code , 302 , channel .result )
490464 uri = channel .headers .getRawHeaders ("Location" )[0 ]
491465
@@ -637,51 +611,26 @@ def test_multi_sso_redirect_to_unknown(self):
637611
638612 def test_client_idp_redirect_to_unknown (self ):
639613 """If the client tries to pick an unknown IdP, return a 404"""
640- channel = self ._make_sso_redirect_request (False , "xxx" )
614+ channel = self ._make_sso_redirect_request ("xxx" )
641615 self .assertEqual (channel .code , 404 , channel .result )
642616 self .assertEqual (channel .json_body ["errcode" ], "M_NOT_FOUND" )
643617
644618 def test_client_idp_redirect_to_oidc (self ):
645619 """If the client pick a known IdP, redirect to it"""
646- channel = self ._make_sso_redirect_request (False , "oidc" )
647- self .assertEqual (channel .code , 302 , channel .result )
648- oidc_uri = channel .headers .getRawHeaders ("Location" )[0 ]
649- oidc_uri_path , oidc_uri_query = oidc_uri .split ("?" , 1 )
650-
651- # it should redirect us to the auth page of the OIDC server
652- self .assertEqual (oidc_uri_path , TEST_OIDC_AUTH_ENDPOINT )
653-
654- @override_config ({"experimental_features" : {"msc2858_enabled" : True }})
655- def test_client_msc2858_redirect_to_oidc (self ):
656- """Test the unstable API"""
657- channel = self ._make_sso_redirect_request (True , "oidc" )
620+ channel = self ._make_sso_redirect_request ("oidc" )
658621 self .assertEqual (channel .code , 302 , channel .result )
659622 oidc_uri = channel .headers .getRawHeaders ("Location" )[0 ]
660623 oidc_uri_path , oidc_uri_query = oidc_uri .split ("?" , 1 )
661624
662625 # it should redirect us to the auth page of the OIDC server
663626 self .assertEqual (oidc_uri_path , TEST_OIDC_AUTH_ENDPOINT )
664627
665- def test_client_idp_redirect_msc2858_disabled (self ):
666- """If the client tries to use the MSC2858 endpoint but MSC2858 is disabled, return a 400"""
667- channel = self ._make_sso_redirect_request (True , "oidc" )
668- self .assertEqual (channel .code , 400 , channel .result )
669- self .assertEqual (channel .json_body ["errcode" ], "M_UNRECOGNIZED" )
670-
671- def _make_sso_redirect_request (
672- self , unstable_endpoint : bool = False , idp_prov : Optional [str ] = None
673- ):
628+ def _make_sso_redirect_request (self , idp_prov : Optional [str ] = None ):
674629 """Send a request to /_matrix/client/r0/login/sso/redirect
675630
676- ... or the unstable equivalent
677-
678631 ... possibly specifying an IDP provider
679632 """
680- endpoint = (
681- "/_matrix/client/unstable/org.matrix.msc2858/login/sso/redirect"
682- if unstable_endpoint
683- else "/_matrix/client/r0/login/sso/redirect"
684- )
633+ endpoint = "/_matrix/client/r0/login/sso/redirect"
685634 if idp_prov is not None :
686635 endpoint += "/" + idp_prov
687636 endpoint += "?redirectUrl=" + urllib .parse .quote_plus (TEST_CLIENT_REDIRECT_URL )
0 commit comments