I’m going to ask if the comes-with-django authentication system will be useful for me or if anyone knows of libraries addressing similar needs.
I have a django CRUD app in a corporate network. Requests will come to me with headers for Group and User. The app doesn’t have any use for a user object, but it does care about groups.
Since valid users and the group membership are administered by other departments, the optimal thing would be to just use the Group header for permission. I see in the docs:
If your authentication mechanism uses a custom HTTP header and not
REMOTE_USER
, you can subclassRemoteUserMiddleware
and set theheader
attribute to the desiredrequest.META
key.
So say I have two groups, “editor” and “publisher”. I could just treat the group header I get as the user; that is, I’d say I have 2 users, “editor” and “publisher” and I tell which of the two users I got from the group header.
I have a little wrinkle on that, naturally… in my setup the Group header has a comma separateed list of groups, “AllUsers,SomeOtherApp-Approver,MyApp-Editor”… so it seems like I’ll have to further modify RemoteUserMiddleware if I go that route, or make make some separate middleware, which sounds daunting to me.
Anyway, I’ve never worked with Django users/groups, any advice?