fix(dashboard-auth): skip auto-SSO redirect for password-only providers - #57319
Closed
karlesnine wants to merge 1 commit into
Closed
fix(dashboard-auth): skip auto-SSO redirect for password-only providers#57319karlesnine wants to merge 1 commit into
karlesnine wants to merge 1 commit into
Conversation
The auto-SSO middleware (_auto_sso_response) redirects an unauthenticated HTML load to /auth/login?provider=... when exactly one interactive provider is registered. For password-only providers (basic auth) this 302s to the OAuth initiation route, whose start_login() raises NotImplementedError — basic auth has no OAuth redirect flow, only /auth/password-login. Fix: check provider.supports_password before auto-redirecting. Password-only providers fall through to the /login interstitial, which renders the password form (POSTing to /auth/password-login). Test: verify that a password-only StubAuthProvider skips the auto-SSO redirect and lands on /login instead of /auth/login. Fixes the Internal Server Error when accessing an auth-gated dashboard that uses basic_auth as its sole authentication provider. Co-authored-by: karlesnine <karles@karlesnine.com>
Collaborator
Duplicate of #54887 (earliest open canonical fix) — same |
Author
|
If 8 other PRs address the same issue, I'll close this one myself. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fix an Internal Server Error (500) when accessing an auth-gated dashboard that uses
basic_authas its sole authentication provider.The auto-SSO middleware redirects unauthenticated HTML loads to
/auth/login?provider=basic— the OAuth initiation route. But basic auth doesn't support OAuth;start_login()raisesNotImplementedError. The fix skips the auto-redirect for password-only providers so the/loginpage renders the password form (POST to/auth/password-login) instead.Related Issue
Fixes a crash when
dashboard.basic_auth.passwordis configured and the dashboard is bound to a non-loopback host (e.g.--host 0.0.0.0).Type of Change
Changes Made
hermes_cli/dashboard_auth/middleware.py— skip auto-SSO redirect when the sole provider hassupports_password = Truetests/hermes_cli/test_dashboard_auth_401_reauth.py— addtest_password_provider_skips_auto_ssoHow to Test
dashboard.basic_auth.passwordinconfig.yamlhermes dashboard --host 0.0.0.0 --port 9119http://<host>:9119without session cookie/loginpage renders with username/password formChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping