Changeset 10411 for main/waeup.cas


Ignore:
Timestamp:
6 Jul 2013, 09:58:16 (11 years ago)
Author:
uli
Message:

Add support for renew parameter.

Location:
main/waeup.cas/trunk/waeup/cas
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.cas/trunk/waeup/cas/server.py

    r10409 r10411  
    208208    def login(self, req):
    209209        service = req.POST.get('service', req.GET.get('service', None))
     210        renew = req.POST.get('renew', req.GET.get('renew', None))
    210211        service_field = ''
    211212        msg = ''
     
    214215        valid_lt = check_login_ticket(self.db, req.POST.get('lt'))
    215216        tgc = check_session_cookie(self.db, req.cookies.get('cas-tgc', None))
    216         if tgc:
     217        if tgc and renew is None:
    217218            if service:
    218219                return login_redirect_service(self.db, service, sso=True)
  • main/waeup.cas/trunk/waeup/cas/tests/test_server.py

    r10410 r10411  
    126126        assert 'Set-Cookie' not in resp.headers
    127127        return
     128
     129    def test_login_renew_with_cookie(self):
     130        # 2.1.1: cookie will be ignored when renew is set
     131        app = CASServer()
     132        tgc = create_tgc_value()
     133        app.db.add(tgc)
     134        value = str(tgc.value)
     135        req = Request.blank('https://localhost/login?renew=true')
     136        req.headers['Cookie'] = 'cas-tgc=%s' % value
     137        resp = app(req)
     138        assert resp.status == '200 OK'
     139        assert b'username' in resp.body
     140        assert 'Set-Cookie' not in resp.headers
     141
     142    def test_login_renew_as_empty_string(self):
     143        # `renew` is handled correctly, even with empty value
     144        app = CASServer()
     145        tgc = create_tgc_value()
     146        app.db.add(tgc)
     147        value = str(tgc.value)
     148        req = Request.blank('https://localhost/login?renew')
     149        req.headers['Cookie'] = 'cas-tgc=%s' % value
     150        resp = app(req)
     151        assert resp.status == '200 OK'
     152        assert b'username' in resp.body
     153        assert 'Set-Cookie' not in resp.headers
    128154
    129155
Note: See TracChangeset for help on using the changeset viewer.