Closed
Description
Hello,
I'm trying to figure out a solution how to add an user to a group after this user is authenticated via SAML.
I was reading through the documentation and it seems overwriting this method might work:
from djangosaml2.backends import Saml2Backend
class MySaml2Backend(Saml2Backend):
def save_user(self, user, *args, **kwargs):
# Add custom logic here
return super().save_user(user, *args, **kwargs)
My question is where should I add this piece of code in my Django project to get it working? I was trying to add it to my settings.py file, but I got an error: django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Or is there any better solution how to add users automatically to Django groups after authentication?
Thanks in advance.