nextcloud / user_oidc

OIDC connect user backend for Nextcloud
GNU Affero General Public License v3.0
76 stars 29 forks source link

Perform "Update Provider" function via occ command #858

Closed jmulaaaa closed 1 month ago

jmulaaaa commented 1 month ago

Description

I have a script that runs on nextcloud startup to perform configuration commands via occ. I have everything setup for user_oidc. The issue I am having is if I just run the commands and try to log in my group mapping is giving me unique identifiers.

Current Solution

All I do to resolve this issue right now is open the UI settings and simply press update provider. I am not changing any options. I understand why this is the case, I just wish there was a "Update" or "Test" configuration command that could perform this same functionality easily via OCC command.

Current Setup Commands:

php occ app:enable user_oidc
php occ user_oidc:provider "Example SSO" --clientid="${OPENID_CLIENT}" --clientsecret="${OPENID_SECRET}" --discoveryuri="${OPENID_URL}" --mapping-uid=oid --mapping-groups=groups
php occ config:app:set --value 1 user_oidc provider-1-groupProvisioning
php occ config:system:set user_oidc single_logout --value false --type=boolean
jmulaaaa commented 1 month ago

I should also add, I know this can be done via API. I would really prefer to not have to use the api.

julien-nc commented 1 month ago

Thanks for reporting this. The unique-uid value is True by default so this is expected if you don't add --unique-uid 0 to occ user_oidc:provider when creating the provider. And there actually is a bug in the settings web page. The default value for unique-uid is not correct so as it's not defined, when you update the provider, it sets it to False. I'm fixing this. PR coming soon. In the meantime, just explicitly defining the value for unique-uid in the occ command to create the provider will solve your issue.

jmulaaaa commented 1 month ago

I appreciate the response. Explicitly defining the value did work for now. Thanks.