nitmir / django-cas-server

A Django Central Authentication Service server implementing the CAS Protocol 3.0 Specification
GNU General Public License v3.0
132 stars 44 forks source link

Is it possible to use django-cas-server in an app without usernames? #35

Closed drcongo closed 6 years ago

drcongo commented 6 years ago

I get an error when trying to log into the service that says Cannot resolve keyword 'username' into field - I'm guessing this might be down to the fact that I am using it in an application that uses a custom user class with email address as the unique field, and no usernames. Is it possible to use django-cas-server on an application like this?

nitmir commented 6 years ago

You just need to write an auth class matching your user db backend. I asume you use the DjangoAuthUser class. Just copy it, rename it, and change it to match you custom user model.

I think just changing this line may work: https://github.com/nitmir/django-cas-server/blob/4229f871c5422e416390e9b8ac58b3d176de49b7/cas_server/auth.py#L416