source: main/waeup.cas/trunk/waeup/cas/server.py @ 10336

Last change on this file since 10336 was 10335, checked in by uli, 12 years ago

Add simple login form.

File size: 830 bytes
Line 
1"""A WSGI app for serving CAS.
2"""
3import os
4from webob import exc, Response
5from webob.dec import wsgify
6
7template_dir = os.path.join(os.path.dirname(__file__), 'templates')
8
9
10class CASServer(object):
11    """A WSGI CAS server.
12    """
13    @wsgify
14    def __call__(self, req):
15        if req.path in ['/login', '/validate', '/logout']:
16            return getattr(self, req.path[1:])(req)
17        return exc.HTTPNotFound()
18
19    def login(self, req):
20        return Response(
21            open(os.path.join(template_dir, 'login.html'), 'r').read())
22        return Response('Hi there!')
23
24    def validate(self, req):
25        return exc.HTTPNotImplemented()
26
27    def logout(self, req):
28        return exc.HTTPNotImplemented()
29
30cas_server = CASServer
31
32
33def make_cas_server(global_conf, **local_conf):
34    return CASServer(**local_conf)
Note: See TracBrowser for help on using the repository browser.