9h37/django-lemonldap — pull request #3 by linkdd (2012-04-18 09:26:48+00:00)
Title: Add sample apache config + Improve middleware/backend

Now, we can subclass the middleware in that way :

```python
from django_lemonldap.lemonsso.auth.middleware import LemonLDAPMiddleware

class MyOwnMiddleware(LemonLDAPMiddleware):
headers = [
('username': 'HTTP_AUTH_USER'),
('mail': 'HTTP_AUTH_MAIL'),
('something', 'HTTP_AUTH_SOMETHING'),
]
```

But that need to redefine the backend too :

```python
from django_lemonldap.lemonsso.auth.backends import LemonLDAPBackend

class MyOwnBackend(LemonLDAPBackend):
def configure_user(self, user, remote_userinfo):
user.email = remote_userinfo['mail']
user.something = remote_userinfo['something']
return user
```

It's better, easier, and more beautiful :)