Warn when "Custom" binding username claim becomes unsupported - #3406
Open
Patryk Mroczko (patmr7) wants to merge 1 commit into
Open
Warn when "Custom" binding username claim becomes unsupported#3406Patryk Mroczko (patmr7) wants to merge 1 commit into
Patryk Mroczko (patmr7) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an admin-facing warning when the OpenID Connect “Binding username claim” is set to Custom but becomes incompatible with the currently configured IdP type and enabled Microsoft 365 user sync, helping prevent misconfiguration after changing related settings.
Changes:
- Hooks the local_o365 user sync setting to trigger validation when user sync options change.
- Adds validation logic in
auth/oidc/lib.phpto warn when “Custom” binding username claim is unsupported for the current IdP + user sync combination. - Introduces a new English language string for the warning message with a link back to the binding username claim settings.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| local/o365/settings.php | Adds an updated-callback on the user sync setting to trigger the new validation. |
| auth/oidc/lib.php | Adds the validation function and calls it from existing auth settings validation. |
| auth/oidc/lang/en/auth_oidc.php | Adds the warning string shown to admins. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+207
to
+220
| function auth_oidc_validate_binding_username_claim() { | ||
| $idptype = get_config('auth_oidc', 'idptype'); | ||
| if (empty($idptype) || get_config('auth_oidc', 'bindingusernameclaim') !== 'custom') { | ||
| return; | ||
| } | ||
|
|
||
| $mstypes = [AUTH_OIDC_IDP_TYPE_MICROSOFT_ENTRA_ID, AUTH_OIDC_IDP_TYPE_MICROSOFT_IDENTITY_PLATFORM]; | ||
| if (in_array($idptype, $mstypes) && auth_oidc_is_local_365_installed() && auth_oidc_is_user_sync_enabled()) { | ||
| $bindingclaimurl = new url('/admin/settings.php', ['section' => 'auth_oidc_binding_username_claim']); | ||
| \core\notification::warning( | ||
| get_string('warning_binding_username_claim_custom_unsupported', 'auth_oidc', $bindingclaimurl->out()) | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.