-
Notifications
You must be signed in to change notification settings - Fork 145
Closed
Labels
DocumentationIssues that document features and specific configuration/use casesIssues that document features and specific configuration/use casesquestion
Description
Does anyone know what's the "official" way of setting is_staff and is_superuser?
My IdP is sending the status as a "true" or "false" string in a specific attribute. However, simply putting the attribute in SAML_ATTRIBUTE_MAPPING is not enough as djangosaml2 will try to assign the string value to the boolean field on the user model where it'll raise an exception upon save.
At the moment I am working around that with a custom authentication backend which overrides the clean_attributes method and "booleanizes" the values there, but I wonder if there's a better way?
Questions:
- Does SAML have the concept of "boolean" values? Do I just need to tell my IdP to send that value as a specific attribute and it'll automatically be interpreted as a boolean by djangosaml2?
- If not, is there a better way to do this?
- If not, should we have a better way? I feel like subclassing the backend for such a basic thing is overkill, and I'd prefer being able to pass arbitrary functions/lambdas in the
SAML_ATTRIBUTE_MAPPINGwhich will be called with the original value and return the transformed value. Then I could just set it to{"IsSuperuser": lambda v: [x == 'true' for x in v]}and be done with it.
Metadata
Metadata
Assignees
Labels
DocumentationIssues that document features and specific configuration/use casesIssues that document features and specific configuration/use casesquestion