Wang1rrr opened a new pull request, #4798: URL: https://github.com/apache/rocketmq-dashboard/pull/4798
### Which Issue(s) This PR Fixes No issue - found while comparing how `AuthInterceptor` and `AuthController` each answer "is a login required". ### Brief Description Both sides compute the flag from the same static property and the same runtime `requireLogin` row, but they disagreed on the failure branches. The interceptor fails closed - an absent or unreadable policy still demands a login - while the controller used `settings != null && settings.isRequireLogin()` and did not catch read failures at all. So when the persisted settings row cannot be read (`MybatisPlusSettingsRepository` throws `BusinessException(500)` for an undeserializable json column), the interceptor still demanded a login while `GET /api/auth/status` answered 500. The frontend reads that flag to choose between the login page and the console (`web/src/App.tsx` `AuthGate`), so it fell to its error screen: the retry re-issued the same failing request, and the login page - which the interceptor would in fact have accepted credentials from - was never rendered. The console became unreachable exactly when the policy store was broken, with no way for an operator to log in and repair it. `isLoginRequired()` now reports the policy the interceptor enforces, including on the failure branches, so the two cannot drift. A follow-up worth considering is extracting the predicate into one shared collaborator so divergence is impossible rather than merely absent. ### How Did You Test This Change? Added cases to `AuthControllerTest` covering the null-settings row and the throwing repository, asserting both report `loginRequired=true` and a 200 body instead of a 500. ``` cd server mvn -B -Dtest=AuthControllerTest,AuthInterceptorTest test [INFO] You have 0 Checkstyle violations. [INFO] Tests run: 11, Failures: 0, Errors: 0, Skipped: 0 -- in org.apache.rocketmq.studio.auth.AuthControllerTest [INFO] Tests run: 52, Failures: 0, Errors: 0, Skipped: 0 -- in org.apache.rocketmq.studio.auth.AuthInterceptorTest [INFO] Tests run: 63, Failures: 0, Errors: 0, Skipped: 0 [INFO] BUILD SUCCESS ``` Backend only: no API shape change, no UI text, no new source files. ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits (`feat:` / `fix:` / `refactor:` / `chore:` / `docs:` / `perf:`) - [x] Tests added or updated for non-trivial changes, test methods named `...Test` - [ ] New UI text has both Chinese and English entries under `web/src/i18n/` - N/A, no UI text - [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit checks) - no new types or packages introduced - [ ] New source files carry the ASF license header - N/A, no new files - [ ] Documentation touched where behaviour changed - N/A, the endpoint contract is unchanged -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
