1 from django.conf import settings
2 from django_cas.backends import CASBackend
4 attr_map = getattr(settings, 'CAS_USER_ATTRS_MAP', {
6 'firstname': 'first_name',
7 'lastname': 'last_name',
10 class AttrCASBackend(CASBackend):
11 def authenticate(self, ticket, service, request):
12 user = super(AttrCASBackend, self).authenticate(ticket, service, request)
13 for attr, value in request.session.get('attributes', {}).items():
15 local_attr = attr_map[attr]
19 setattr(user, local_attr, value)