Skip to content

Properly load roles for external backend user#5463

Closed
sukhwinder33445 wants to merge 1 commit intomainfrom
fix/properly-load-roles-for-external-backend
Closed

Properly load roles for external backend user#5463
sukhwinder33445 wants to merge 1 commit intomainfrom
fix/properly-load-roles-for-external-backend

Conversation

@sukhwinder33445
Copy link
Copy Markdown
Contributor

@sukhwinder33445 sukhwinder33445 commented Jan 9, 2026

fixes #5464

Bootstrap: Module Loading and Authentication Order:

First, bootstrap->loadEnabledModules() is executed. Then the authentication configuration (authentication.ini) is loaded and initialized via bootstrap->setupUserBackendFactory(). Only after these steps, the login form is evaluated, and the user is authenticated.

The problem is caused by the call to IcingadbSupport::useIcingaDbAsBackend() in the modules’ run.php file.

When bootstrap->loadEnabledModules() loads a module, its run.php file is executed immediately. The call to IcingadbSupport::useIcingaDbAsBackend() triggers the following call chain: hasPermission() -> isAuthenticated() -> authExternal().

Normally, modules are loaded without an authenticated user because this call chain returns false. However, when an external user logs in, authExternal() marks the user as authenticated by calling setAuthenticated().

At this point, UserBackend::$backends is not yet initialized. Because of this, user groups and roles cannot be loaded.

Icinga Web 2 shows the following error:

NOTICE: PHP message: icingaweb2: ERROR - Can't get group memberships for user 'user' from backend 'auth_ldap'. An exception was thrown: Icinga\Exception\ConfigurationError in /icingaweb2/library/Icinga/Authentication/User/UserBackend.php:74 with message: User backends not set up. Please contact your Icinga Web administrator

@sukhwinder33445 sukhwinder33445 self-assigned this Jan 9, 2026
@cla-bot cla-bot Bot added the cla/signed label Jan 9, 2026
@sukhwinder33445 sukhwinder33445 marked this pull request as draft January 9, 2026 12:18
@sukhwinder33445 sukhwinder33445 changed the title Properly load roles for external backend Properly load roles for external backend user Jan 9, 2026
@sukhwinder33445 sukhwinder33445 force-pushed the fix/properly-load-roles-for-external-backend branch 2 times, most recently from 0803061 to 8034c84 Compare January 9, 2026 16:42
@sukhwinder33445 sukhwinder33445 force-pushed the fix/properly-load-roles-for-external-backend branch from 8034c84 to 6848ee3 Compare January 9, 2026 16:42
@nilmerg
Copy link
Copy Markdown
Member

nilmerg commented Jan 12, 2026

Sounds like #5387 solves the linked issue as well.

@sukhwinder33445
Copy link
Copy Markdown
Contributor Author

Yes, #5387 solves this issue.

@sukhwinder33445 sukhwinder33445 deleted the fix/properly-load-roles-for-external-backend branch January 13, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

External Auth: Roles and usergroups are not loaded properly with ldap backend

2 participants