Exemple #1
0
    def dispatch(self, request, *args, **kwargs):
        # We do not log here, because we have a handler registered to perform logging on successful logouts.
        request.is_from_logout = True

        # Get third party auth provider's logout url
        self.tpa_logout_url = tpa_pipeline.get_idp_logout_url_from_running_pipeline(
            request)

        logout(request)

        response = super().dispatch(request, *args, **kwargs)

        # Clear the cookie used by the edx.org marketing site
        delete_logged_in_cookies(response)

        return response
Exemple #2
0
 def test_get_idp_logout_url_from_running_pipeline(self, idp_type,
                                                   backend_name):
     """
     Test idp logout url setting for running pipeline
     """
     self.enable_saml()
     idp_slug = "test"
     idp_config = {"logout_url": "http://example.com/logout"}
     getattr(self, f'configure_{idp_type}_provider')(
         enabled=True,
         name="Test Provider",
         slug=idp_slug,
         backend_name=backend_name,
         other_settings=json.dumps(idp_config))
     request = mock.MagicMock()
     kwargs = {"response": {"idp_name": idp_slug}}
     with simulate_running_pipeline(
             "common.djangoapps.third_party_auth.pipeline", backend_name,
             **kwargs):
         logout_url = pipeline.get_idp_logout_url_from_running_pipeline(
             request)
         assert idp_config['logout_url'] == logout_url