Skip to content

SSO provider supplies groups as a string resulting in module error message: ($groups) must be of type array, string given #11

Description

@sol1-matt

icinga-sso-web module version: 1.0.0
provider: Jumpcloud

Error message

Icinga\User::setGroups(): Argument #1 ($groups) must be of type array, string given, called in /usr/share/icingaweb2/modules/sso/application/controllers/OidcController.php on line 113

Expected result: No error message

Tested solution: Added is_string check and convert to array in sso/application/controllers/OidcController.php:95 before group parsing. After adding this SSO works as expected without error.

        if (is_string($groups)) {
            $groups = array_filter(array_map('trim', explode(',', $groups)));
        }

        if ($groups !== null) {
            $groupnameSearch = $login->config->groupname_search ?? '';

            if ($groupnameSearch !== '') {
                $groups = array_map(function ($group) use ($groupnameSearch, $login): string {
                    return preg_replace($groupnameSearch, $login->config->groupname_replace ?? '', $group);
                }, $groups);
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions