I have two different classes of user for a Django-based event registration system. Let's call them "Registrant" and "Staffer".
These two are not mutually exclusive, and I see no reason not to use the same User model for both classes (with a flag to distinguish them).
A Registrant can sign in by verifying their identity with a third-party API, and can then register for an event.
A Staffer has access to Django Admin, and can manage events. I do not trust the third-party API to sufficiently authenticate somebody who has Staffer access as, while it does request personal information to identify someone, it doesn't ask for anything as secure as a password. I therefore want Staffers to enter in a password instead of authenticate via the third-party API.
I see that I can write a custom auth backend in Django, and I can customise the default User model to suit my needs regarding aforementioned flags (though I suspect the default is_staff) flag might be sufficient).
Unfortunately, while I know that I can use multiple authentication backends, I am quite stuck working out how to:
a) determine which authentication backend to use (e.g. use the Registrant auth backend in the frontend, and the Staffer auth backend in the Admin) b) only allow users authenticated via the Staffer auth backend to access the Admin
Can anybody please point me in the right direction?
Apologies for the lack of code; I'm re-working the auth system from scratch (because the previous version was really badly hacked together) and I don't quite know where to start.
EDIT: There is some useful info at Django Multiple Authentication Backends Based On Status, but because I would like to use the same User model for both user classes, and both auth backends would request different types of credentials (e.g. one requesting a password, the other not), I need to think more about how to tackle this.