Example #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(LogoutView, self).dispatch(request, *args, **kwargs)

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

        return response
Example #2
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)

        # Get the list of authorized clients before we clear the session.
        self.oauth_client_ids = request.session.get(
            edx_oauth2_provider.constants.AUTHORIZED_CLIENTS_SESSION_KEY, [])

        logout(request)

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

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

        return response
Example #3
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,
             'configure_{idp_type}_provider'.format(idp_type=idp_type))(
                 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("third_party_auth.pipeline",
                                    backend_name, **kwargs):
         logout_url = pipeline.get_idp_logout_url_from_running_pipeline(
             request)
         self.assertEqual(idp_config['logout_url'], logout_url)