protected function mapGroupName($request, $groupName)
    {
        if (isset($request["SPMetadata"]["groupMapping"]) &&
            isset($request["SPMetadata"]["groupMapping"][$groupName])) {
            Logger::debug(
                "Mapping $groupName to " . $request["SPMetadata"]["groupMapping"][$groupName] .
                " for SP " . $request["SPMetadata"]["entityid"]
            );
            return $request["SPMetadata"]["groupMapping"][$groupName];
        } elseif (isset($request["SPMetadata"][self::GROUPNAMEPREFIX_ATTR])) {
            Logger::debug(
                "GroupNamePrefix overridden by a SP " . $request["SPMetadata"]["entityid"] .
                " to " . $request["SPMetadata"][self::GROUPNAMEPREFIX_ATTR]
            );
            return $request["SPMetadata"][self::GROUPNAMEPREFIX_ATTR] . $groupName;
        } else {
            # No mapping defined, so just put groupNamePrefix in front of the group
            Logger::debug(
                "No mapping found for group $groupName for SP " . $request["SPMetadata"]["entityid"]
            );
            return $this->groupNamePrefix . $groupName;
        }
    }