-
Notifications
You must be signed in to change notification settings - Fork 146
Description
I've got a multi-IdP setup, with a custom loader, that varies based on the Company (pulled from the URL) you're attempting to log into. That side of the equation seems to work well.
The problem is new users. The User (custom model) instance gets created. And can be used, but I need to link that to the Company. There's a company
FK (so company_id in raw terms) field.
This ID is not communicated from the IdP. And that's by-design. allowing the IdP to set the company would be a security hole. I need some way to tie new users on a given IdP to their company.
I have one config per company. Ideally I'd be able to set something that poisoned the attributes, or something that explicitly got used in backends._get_or_create_saml2_user
. A config-static dictionary eg NEW_USER_DEFAULTS
, seems reasonable but I can't figure out how to access the IdP config in use from within backends._get_or_create_saml2_user
. That data doesn't appear to exist by that point.
I've also considered hooking djangosaml2.signals.pre_user_save
but again, I don't think I have access to the saml config in use by that point.
Can somebody point me in the right direction?