Skip to content
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

New system config flag to disable user creation in soft auto provisioning #954

Merged
merged 3 commits into from
Oct 7, 2024

Conversation

julien-nc
Copy link
Member

We are missing a use case in soft auto provisioning. Some people might want to only accept Oidc logins from users that already exist in other backends (like when auto provisioning is disabled) but still want user_oidc to set the mapped attributes to the user (like when soft auto provisioning is enabled and the user already exists in another backend).

There were 2 ways to do that:

  1. Add an option that makes it happen when auto provisioning is disabled (like force_attribute_provisioning)
  2. Add an option that forbids account creation when soft auto provisioning is enabled

We chose 2. with @come-nc thinking it's slightly easier to grasp when configuring user_oidc.

@@ -149,6 +109,17 @@ public function provisionUser(string $tokenUserId, int $providerId, object $idTo
if ($existingLocalUser !== null) {
$user = $existingLocalUser;
} else {
// if disable_account_creation is true, user_oidc should not manage user
// - no user creation
// - do not use the existing users managed by the user_oidc backend
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum but what if user_oidc created some users and then I enable the new option, these users disappear? Or at least cannot login anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They can't login... I took the easy way. I can change that behaviour. Do you think it makes more sense to let them in?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh no I just had another read of the code. It's fine. If some users were created by user_oidc before disable_account_creation was switched on, they can still connect after. The comment was wrong and is now fixed.

@julien-nc julien-nc force-pushed the enh/noid/disable-user-creation-soft-auto-pro branch from 131c502 to f77068a Compare October 1, 2024 15:43
@julien-nc julien-nc requested a review from come-nc October 2, 2024 10:12
@julien-nc julien-nc force-pushed the enh/noid/disable-user-creation-soft-auto-pro branch from f81e27c to 40317da Compare October 3, 2024 13:07
@julien-nc julien-nc force-pushed the enh/noid/disable-user-creation-soft-auto-pro branch from 40317da to a7eb94f Compare October 7, 2024 14:27
@julien-nc julien-nc merged commit 858a151 into main Oct 7, 2024
44 checks passed
@julien-nc julien-nc deleted the enh/noid/disable-user-creation-soft-auto-pro branch October 7, 2024 14:34
@julien-nc julien-nc mentioned this pull request Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants