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

Remove @domain.com from UPN during authentication #2306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

amorrowbellarmine
Copy link
Contributor

@amorrowbellarmine amorrowbellarmine commented Jun 13, 2023

This is part of an alternative solution to the request for using the sAMAccountname from AD.
#2157
#2212

This pull requests add an option to the authentication plugin to remove the @domain.com portion of a person's username found in the claim information. The new "stripped" username is then used to match a corresponding Moodle user. This is useful for organizations that need the Moodle username to remain in the sAMAccountname format for 3rd party integrations.

The usersync code of the o365 plugin already has a code snippet where it splits the user's UPN for matching it to a Moodle username. This request borrows that code and adds it to the OIDC authentication plugin.

$upnsplit = explode('@', $upnlower);
if (!empty($upnsplit[0])) {
$aadusers[$i]['upnsplit0'] = $upnsplit[0];
$usernames[] = $upnsplit[0];
}

This will allow the OIDC plugin to match username@domain.com from the claim to a Moodle user without relying on the usersync process to populate the o365_objects table.

This is useful for organizations that need the Moodle username to remain in the sAMAccountname format for 3rd party integrations.
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.

None yet

1 participant