+ /**
+ * Check if the given external auth ID string matches one of the given group names.
+ */
+ protected function externalIdMatchesGroupNames(string $externalId, array $groupNames): bool
+ {
+ $externalAuthIds = explode(',', strtolower($externalId));
+
+ foreach ($externalAuthIds as $externalAuthId) {
+ if (in_array(trim($externalAuthId), $groupNames)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+