Changeset 10416 for main/waeup.cas/trunk/waeup/cas/server.py
- Timestamp:
- 8 Jul 2013, 08:35:22 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/server.py
r10415 r10416 59 59 60 60 61 def check_service_ticket(db, ticket, service, renew=False): 62 """Check whether (`ticket`, `service`) represents a valid service 63 ticket in `db`. 64 65 Returns a database set or ``None``. 66 """ 67 if None in (ticket, service): 68 return None 69 ticket, service = str(ticket), str(service) 70 q = db.query(ServiceTicket).filter( 71 ServiceTicket.ticket == ticket).filter( 72 ServiceTicket.service == service).first() 73 if renew and q.sso: 74 return None 75 return q 76 77 61 78 def create_login_ticket(): 62 79 """Create a unique login ticket. … … 74 91 if lt_string is None: 75 92 return False 76 q = db.query(LoginTicket).filter(LoginTicket.ticket == lt_string)93 q = db.query(LoginTicket).filter(LoginTicket.ticket == str(lt_string)) 77 94 result = [x for x in q] 78 95 if result: … … 283 300 284 301 def validate(self, req): 285 return exc.HTTPNotImplemented() 302 service = req.POST.get('service', req.GET.get('service', None)) 303 ticket = req.POST.get('ticket', req.GET.get('ticket', None)) 304 renew = req.POST.get('renew', req.GET.get('renew', None)) 305 renew = renew is not None 306 st = check_service_ticket(self.db, ticket, service, renew) 307 if st is not None: 308 return Response('yes' + chr(0x0a) + st.user + chr(0x0a)) 309 return Response('no' + chr(0x0a) + chr(0x0a)) 286 310 287 311 def logout(self, req):
Note: See TracChangeset for help on using the changeset viewer.