providers/scim: modify user- and group syncing behavior#13947
providers/scim: modify user- and group syncing behavior#13947BeryJu merged 8 commits intogoauthentik:mainfrom
Conversation
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
15e241c to
54e4e2c
Compare
| pk__in=[ | ||
| user.pk | ||
| for user in base | ||
| if PolicyEngine(self.backchannel_application, user, None).build().passing | ||
| ] |
There was a problem hiding this comment.
It might be helpful to extend Application with the function get_users_allowed_to_view which generates a queryset of Users, subsequently centralizing this logic.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13947 +/- ##
==========================================
- Coverage 93.24% 93.23% -0.02%
==========================================
Files 965 967 +2
Lines 53196 53269 +73
==========================================
+ Hits 49603 49664 +61
- Misses 3593 3605 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
3eb9b17 to
74ca7d3
Compare
|
Another design decision to be had is: My initial thought is to change the syncing behavior when no groups are selected from syncing all groups to none. related to: #13441 |
74ca7d3 to
c013f0a
Compare
BeryJu
left a comment
There was a problem hiding this comment.
Code looks good, we're discussing internally how to best deal with the migration path and to not break any existing setups.
I think if during the migration we detect the SCIM provider has one filter group selected, we enabled dry-run in the migration to effectively disable the provider until the user has reviewed the config. (Also I can't think of a scenario where you'd have a different set of users provisioned in SCIM than users who can access the application but it might exist somewhere).
The other thing that we want to do before shipping this is optimize the PolicyEngine more, especially when using user or group bindings as without optimizations this would have quite a performance impact especially with a lot of providers setup.
Sounds like a good idea. Especially in regards to how an empty selection for |
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Sorry for the once again delayed response, we've since merged a big improvement to the PolicyEngine that uses a lot less queries and time for static user/group bindings so from that aspect we can go ahead with this one. I've merged the migrations and set the dry_run to true in the migration if a filter group has been set and merged main into that. for the cc @goauthentik/backend for thoughts |
|
One thing we should also do for this is post-sync review to compare the SCIM users in our database with the users that have access and deactivate/remove any users that were synced but no longer have access |
|
I have gone ahead and fixed the linting issues.
This solution definitely makes sense in the current authentik "eco-system", however I believe that this might be a symptom of an underlying issue. I have created Issue 15816 where I explain this further since it doesn't affect this PR directly. If the backend-team agrees with the 3-state enum approach I can go ahead and see if it is feasible for me to implement this feature.
I agree that this feature should be introduced. |
449ebd6 to
2a9252f
Compare
|
@ImmanuelVonNeumann sorry for keeping this waiting for so long, I still want to get this merged but I haven't gotten around to re-reviewing this and figuring out solutions for the issues in this thread |
rename filtergroup to groupfilters and allow multiple values only sync groups which are in the scimprovider's attribute \"group_filters\" only sync users which are entitled to view the scimprovider's application
Signed-off-by: Immanuel von Neumann <45020096+ImmanuelVonNeumann@users.noreply.github.com>
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
2a9252f to
9a5cc79
Compare
|
@BeryJu I have gone ahead and rebased the PR. In my opinion, the current implementation is the most simplistic and implicit usage:
If you would want to sync no groups you would have to make an empty "placeholder group" you select. |
9a5cc79 to
abb160e
Compare
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* main: (52 commits) website: QL Search keyboard interactions docs, examples. (#16259) website/integrations: immich: add signing algorithm (#19187) website/docs: endpoint devices: add version command (#19767) common: introduce common (#19852) web: bump @sentry/browser from 10.37.0 to 10.38.0 in /web in the sentry group across 1 directory (#19871) core: bump debugpy from 1.8.19 to 1.8.20 (#19872) ci: bump actions/cache from 5.0.2 to 5.0.3 (#19873) web: bump chromedriver from 144.0.1 to 145.0.0 in /web (#19874) web: Captcha Refinements, Part 2 (#19757) root: assign cherry-pick PRs to original author (#19858) web: Lit Development Mode, performance fixes. (#19825) web: Fix development theme overrides (#19826) website/docs: add tip for recovering from accidental main branch work (#19865) web: bump API Client version (#19857) rbac: clean up roles and permissions (#19588) web: bump API Client version (#19851) website/docs: add more info to entra id scim doc (#19849) sources/oauth: Fix an issue where wechat may crash duing login. (#18973) providers/scim: fix email validation mismatch (#19848) providers/scim: modify user- and group syncing behavior (#13947) ...
Details
This is the successor to #13550 with two main changes:
Full Details:
This PR aims to change user and group filtering of the SCIMProvider by incorporating the following changes:
filter_grouptogroup_filters(including django migrations to keep a previously selected filter_group present)group_filtersgroup_filtersare synced to the SCIM ServerReasoning:
Most SCIM Clients allow groups to be filtered, however authentik currently does not.
This issue has been mentioned in #6065 which has been given the
enhancement/confirmed-label.Among the many use-cases one would be a multi-tenant setup where groups of one tenant should not be visible to another tenant.
I have chosen to rename the attribute to "group_filters" as I believe it to be more explanatory.
My understanding of a "filter_group" is a group that has filtering logic (not limited to groups but rather defined by groups).
Whereas a "group_filter" filters groups.
If this change is not welcome, I am happy to undo it.
Note
Since this does change user- and group-syncing behavior (f.e. not syncing previously synced groups anymore) as well as the schema, I suggest this change to be implemented in a major release.
Fixes #6065
Checklist
ak test authentik/)make lint-fix)If an API change has been made
make gen-build)If changes to the frontend have been made
make web)If applicable
make website)