Django RemoteUserBackend for REMOTE_USER authentication and LDAP authorisation.
This class was written to integrate a django app with our LDAP/Kerberos setup. Apache handles Kerberos and passes the name of an authorised user via the REMOTE_USER variable. This script does a simple LDAP lookup to determine if the user should be a superuser. You could easily modify this to add users to different groups depending on which LDAP groups they are in.