]> snippets.scripts.mit.edu Git - Scripts/git/.git/blame - django/README.md
kdo: Upstream krb5 now supports kswitch
[Scripts/git/.git] / django / README.md
CommitLineData
7fff57b6
AD
1`/mit/__init__.py` contains some useful functionality for Django applications
2running at MIT, particularly on the scripts.mit.edu platform
3
4- `zephyr(msg, clas, instance, rcpt)` sends a zephyr (by shelling out to
5 zwrite). This may be useful for debugging or logging
6- `ScriptsRemoteUserMiddleware` and `ScriptsRemoteUserBackend` work together to
7 auto-create users from certificates on scripts.mit.edu-hosted sites. Account
8 details are automatically retrieved from LDAP.
9- `scripts_login` is a view that tries to log users into a site using certs.
10
11To use them, you'll probably want to symlink or copy the `mit` directory into
12your project, add it to your apps list, and modify your middlewares and auth
13backend appropriately. Do *not* link this (the `django` directory) into your
14app; it's reasonably likely to break your `import django.foo` statements.
15
16This code is descended from work on
17[Remit](https://remit.scripts.mit.edu/trac/) and the [ASA
18DB](https://asa.scripts.mit.edu/trac/); current and past bugs are likely to be
19filed there.
20
21Using certificate authentication
22--------------------------------
23
241. Copy the `mit` directory into your project
252. Update settings.py
26 - Add `mit.ScriptsRemoteUserMiddleware` to the end of `MIDDLEWARE_CLASSES`
27 - Add `mit.ScriptsRemoteUserBackend` to the beginning of
28 `AUTHENTICATION_BACKENDS`
293. Add `url(r'^accounts/login/', 'mit.scripts_login', name='login', )` to
30 your `urls.py`. This causes `@login_required` and similar mechanisms to
31 automatically redirect users to port 444 and log them in with certificates.
32