-
-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic SAML Role mapping #1038
Comments
@Taeir do you have thoughts on this? (No pressure; just asking you because you probably know more about SAML than anyone else on the team.) |
Code wise it is relatively easy to do (we do it for my company too). Note however that the library that QPixel uses for SAML authentication only gives access to a single attribute value. So if your roles attribute contains multiple roles, only the first value is picked up. This may or may not be a problem for your use case. For the used library there is an old issue (apokalipto/devise_saml_authenticatable#61) about it and even a pull request (apokalipto/devise_saml_authenticatable#159), but it's been open for years so it does not look like it is getting a lot of focus. Perhaps we can bump that a little? In the file def saml_init_role=(role)
case role
when 'COMPANY_GLOBAL_MODERATOR'
self.staff = true
self.is_global_moderator = true
when 'COMPANY_GLOBAL_ADMINISTRATOR'
self.staff = true
self.is_global_admin = true
when 'COMPANY_GLOBAL_DEVELOPER'
self.staff = true
self.developer = true
end
end It is also possible to do more fine grained stuff like assigning specific privileges to users with specific roles, but this is separated per community and would only give privileges to the community being signed into. Let me know if you also need something for that. As for adding this into QPixel by default, we could potentially have a COMPANY_GLOBAL_ADMIN: global_admin
COMPANY_GLOBAL_MOD: global_mod
COMPANY_GLOBAL_STAFF: global_staff This could then be processed by the saml_init_role method, which could look like (untested!) def saml_init_role=(role)
roles = YAML.load_file(Rails.root.join('config/saml_roles.yml'))
case roles[role]
when 'global_admin'
self.is_global_administrator = true
self.staff = true
when 'global_mod'
self.is_global_mod = true
self.staff = true
when 'global_staff'
self.staff = true
end
end (Though perhaps nicer to load the config only once and store it in the general configuration rather than upon every sign in request). |
And if an organization already has SAML roles with different names, but the same single-role constraint already mentioned, using those roles would be a simple matter of locally editing the names in |
Hi !
Is your feature request related to a problem? Please describe.
I'm currently setting up an autonomous qpixel instance. I would like to map roles to the admin and moderator roles already in QPixel. Currently I have to manualy setup role.
Describe the solution you'd like
I would like to have a mapping for roles when connecting with SSO (ex: my XML returns an attribute "roles" with values like "COMPANY_GLOBAL_ADMINISTRATOR").
Note that the role name is tied to the company i'm working with, that's why I need to be able to use custom role values.
This mapping could maybe be made in a separate yaml file or in attribute_map.yml for example
In my specific case, I only want to be able to map global administrators and global moderators automaticaly for specific users
Describe alternatives you've considered
The only alternative I have right now is to remap every roles for every user manually.
I tried to edit the saml_init.rb file but I could not manage to add the new property (I'm not really familiar with Ruby). Maybe if someone could explain me globaly how the mapping of the other attributes works in QPixel, I could try to implement this on my instance, test, and then make a pull request.
The text was updated successfully, but these errors were encountered: