fangli / django-saml2-auth

Django SAML2 Authentication Made Easy. Easily integrate with SAML2 SSO identity providers like Okta
Other
504 stars 223 forks source link

New AFTER_LOGIN trigger #92

Open alexazevedo opened 5 years ago

alexazevedo commented 5 years ago

Hello! Thank you for all your hard work on this plugin. We are integrating it with Okta and it works really well! So, we need want to rely only on the SAML service for user authorization (getting user groups from Okta and creating a custom Authentication backend for this). One of the ideas that we have is to store the user group in the session and then recover it inside a middleware or a custom Authentication backend. To do that we might want to have a different trigger that is fired after login. We tried to use the built in "BEFORE_LOGIN" but it doesn't work for us, since you flush the session right before call the login function in the acs view on views.py.

What do you think about having a AFTER_LOGIN trigger, that is fired right after the the login, if it's successful ?

alexazevedo commented 5 years ago

I've just implemented these changes in this PR: https://github.com/fangli/django-saml2-auth/pull/93 Could guys please check it out and give your thoughts?