Skip to content

Warn when "Custom" binding username claim becomes unsupported - #3406

Open
Patryk Mroczko (patmr7) wants to merge 1 commit into
MOODLE_405_STABLEfrom
wip-121467-m405
Open

Warn when "Custom" binding username claim becomes unsupported#3406
Patryk Mroczko (patmr7) wants to merge 1 commit into
MOODLE_405_STABLEfrom
wip-121467-m405

Conversation

@patmr7

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.php to 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 thread auth/oidc/lib.php
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())
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants