Пример #1
0
 def test_with_url(self):
     self.assertEqual(
         create_cas_logout_url(
             'http://sso.pdx.edu',
             '/cas/logout',
             'http://localhost:5000',
         ),
         'http://sso.pdx.edu/cas/logout?url=http%3A%2F%2Flocalhost%3A5000')
Пример #2
0
 def test_minimal(self):
     self.assertEqual(
         create_cas_logout_url(
             'http://sso.pdx.edu',
             '/cas/logout'
         ),
         'http://sso.pdx.edu/cas/logout',
     )
Пример #3
0
 def test_minimal(self):
     self.assertEqual(
         create_cas_logout_url(
             'http://sso.pdx.edu',
             '/cas/logout'
         ),
         'http://sso.pdx.edu/cas/logout',
     )
Пример #4
0
 def test_with_url(self):
     self.assertEqual(
         create_cas_logout_url(
             'http://sso.pdx.edu',
             '/cas/logout',
             'http://localhost:5000',
         ),
         'http://sso.pdx.edu/cas/logout?url=http%3A%2F%2Flocalhost%3A5000'
     )
Пример #5
0
def logout():
    cas_username_session_key = current_app.config['CAS_USERNAME_SESSION_KEY']

    if cas_username_session_key in flask.session:
        del flask.session[cas_username_session_key]

    if current_app.config['CAS_AFTER_LOGOUT']:
        redirect_url = create_cas_logout_url(
            current_app.config['CAS_SERVER'],
            current_app.config['CAS_LOGOUT_ROUTE'],
            current_app.config['CAS_AFTER_LOGOUT'])
    else:
        redirect_url = create_cas_logout_url(
            current_app.config['CAS_SERVER'],
            current_app.config['CAS_LOGOUT_ROUTE'])

    current_app.logger.debug('Redirecting to: {0}'.format(redirect_url))
    return flask.redirect(redirect_url)
Пример #6
0
    def logout(self, session: Session):
        """
        When the user accesses this route they are logged out.
        """

        cas_username_session_key = settings['CAS_USERNAME_SESSION_KEY']
        cas_attributes_session_key = settings['CAS_ATTRIBUTES_SESSION_KEY']

        if cas_username_session_key in session:
            del session[cas_username_session_key]

        if cas_attributes_session_key in session:
            del session[cas_attributes_session_key]

        if settings['CAS_AFTER_LOGOUT'] is not None:
            redirect_url = create_cas_logout_url(settings['CAS_SERVER'],
                                                 settings['CAS_LOGOUT_ROUTE'],
                                                 settings['CAS_AFTER_LOGOUT'])
        else:
            redirect_url = create_cas_logout_url(settings['CAS_SERVER'],
                                                 settings['CAS_LOGOUT_ROUTE'])

        logger.debug('Redirecting to: {0}'.format(redirect_url))
        return redirect(redirect_url)