[studio] fix: honor configurable login protection in frontend routes - #668
Open
ai-yang wants to merge 1 commit into
Open
[studio] fix: honor configurable login protection in frontend routes#668ai-yang wants to merge 1 commit into
ai-yang wants to merge 1 commit into
Conversation
ai-yang
marked this pull request as ready for review
July 29, 2026 07:47
Author
|
Hi maintainers, the CI workflow for this fork PR is currently marked Could someone with write access please approve and run the workflow when convenient? The local verification results are included in the PR description. Thank you! |
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.
Summary
GET /api/auth/statusendpoint that reports whether login is required and whether the optional bearer token is active/login, preserving the frontend-only mock workflow whenVITE_USE_MOCK=true/login; fail closed with a localized retry state when the status request failsFixes #664. This is the small Track 1 / BASE-01 login-flow unit discussed in #427 and follows up the configurable authentication added by #533. It intentionally does not modify
web/src/api/client.ts, avoiding overlap with #662.Root cause
The backend interceptor honors
STUDIO_AUTH_LOGIN_REQUIRED, but the React router had no way to discover that configuration. Unauthenticated users could render management pages, receive 401 responses, and be reloaded to the still-unguarded/route instead of reaching/login.Verification
mvn -B -ntp -Dtest=AuthControllerTest,AuthInterceptorTest test— 11 tests passedmvn -B -ntp test— 452 tests passedmvn -B -ntp checkstyle:check— 0 violationsnpm test -- --run src/api/auth.test.ts src/App.test.tsx— 9 tests passednpm run lint— passed (4 existing Fast Refresh warnings)npm run build— passedloginRequired=false;/instance/topicserved the SPAauthenticated=false; protected API returned 401authenticated=true; protected API returned 200authenticated=false; protected API returned 401Existing test-suite issue
The full frontend run completed 232 of 233 tests. The unchanged
ClusterPage.test.tsxfailed because the page mutates its mock connection count withMath.random()every two seconds while the test asserts the fixed value1,842; an isolated rerun observed1,776. The cluster page, its mock data, and that test are unchanged fromrocketmq-studioand are outside this PR's scope.