Skip to content

Gate external auth providers behind SERVER_MODE on Desktop Mode - #10240

Open
dev-hari-prasad wants to merge 1 commit into
pgadmin-org:masterfrom
dev-hari-prasad:performance/gate-auth-providers-server-mode
Open

Gate external auth providers behind SERVER_MODE on Desktop Mode #10240
dev-hari-prasad wants to merge 1 commit into
pgadmin-org:masterfrom
dev-hari-prasad:performance/gate-auth-providers-server-mode

Conversation

@dev-hari-prasad

@dev-hari-prasad dev-hari-prasad commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Gate external authentication providers (kerberos, ldap, mfa, oauth2, webserver) behind config.SERVER_MODE. Desktop mode (SERVER_MODE = False) now only imports and registers internal authentication, avoiding unnecessary module overhead at startup.

Changes

  • web/pgadmin/authenticate/registry.py: Gate external auth imports & init_app inside load_modules() with if config.SERVER_MODE:.
  • web/pgadmin/authenticate/tests/test_auth_gating.py: Added unit tests verifying external providers are not imported in desktop mode and are loaded in server mode.

Verification & Performance

  • Tests: pytest 2/2 PASSED, pycodestyle 0 errors.
  • Startup Improvement: load_modules() execution dropped from ~138 ms (Server Mode) to < 1 ms (Desktop Mode).

Partially addresses #10221

Summary by CodeRabbit

  • Bug Fixes

    • Desktop mode now loads only internal authentication, preventing unnecessary external authentication providers from being initialized.
    • Server mode continues to support configured external providers, including Kerberos, LDAP, MFA, OAuth2, and webserver authentication.
  • Tests

    • Added coverage to verify authentication-provider loading behavior in both desktop and server modes.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 40cbce75-2877-4dac-8170-2d8231f01a93

📥 Commits

Reviewing files that changed from the base of the PR and between 067f7af and 6a9bbbe.

📒 Files selected for processing (2)
  • web/pgadmin/authenticate/registry.py
  • web/pgadmin/authenticate/tests/test_auth_gating.py

Walkthrough

The authentication registry now loads only internal authentication in desktop mode. In server mode, it loads and registers configured external providers. New tests verify module imports, registry state, and provider registration for both modes.

Changes

Authentication loading gates

Layer / File(s) Summary
Gate external authentication providers by mode
web/pgadmin/authenticate/registry.py, web/pgadmin/authenticate/tests/test_auth_gating.py
The registry uses config.SERVER_MODE to control external provider loading. Tests verify desktop-mode exclusion and server-mode registration for Kerberos, LDAP, MFA, OAuth2, and webserver providers.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: gating external authentication providers behind SERVER_MODE for Desktop Mode.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant