{"record":{"id":"bb9b2a805e4ae42e","repo":"shuzheng/zheng","slug":"s","errorCode":null,"errorMessage":"未注册的系统:%s","messagePattern":"未注册的系统:(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/SSOController.java","lineNumber":79,"sourceCode":"\n    @Autowired\n    UpmsSessionDao upmsSessionDao;\n\n    @ApiOperation(value = \"认证中心首页\")\n    @RequestMapping(value = \"/index\", method = RequestMethod.GET)\n    public String index(HttpServletRequest request) throws Exception {\n        String appid = request.getParameter(\"appid\");\n        String backurl = request.getParameter(\"backurl\");\n        if (StringUtils.isBlank(appid)) {\n            throw new RuntimeException(\"无效访问！\");\n        }\n        // 判断请求认证系统是否注册\n        UpmsSystemExample upmsSystemExample = new UpmsSystemExample();\n        upmsSystemExample.createCriteria()\n                .andNameEqualTo(appid);\n        int count = upmsSystemService.countByExample(upmsSystemExample);\n        if (0 == count) {\n            throw new RuntimeException(String.format(\"未注册的系统:%s\", appid));\n        }\n        return \"redirect:/sso/login?backurl=\" + URLEncoder.encode(backurl, \"utf-8\");\n    }\n\n    @ApiOperation(value = \"登录\")\n    @RequestMapping(value = \"/login\", method = RequestMethod.GET)\n    public String login(HttpServletRequest request) {\n        Subject subject = SecurityUtils.getSubject();\n        Session session = subject.getSession();\n        String serverSessionId = session.getId().toString();\n        // 判断是否已登录，如果已登录，则回跳\n        String code = RedisUtil.get(ZHENG_UPMS_SERVER_SESSION_ID + \"_\" + serverSessionId);\n        // code校验值\n        if (StringUtils.isNotBlank(code)) {\n            // 回跳\n            String backurl = request.getParameter(\"backurl\");\n            String username = (String) subject.getPrincipal();\n            if (StringUtils.isBlank(backurl)) {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/shuzheng/zheng/blob/7005c0a775e6d014d1dc8a8a809f7b1c13bf785a/zheng-upms/zheng-upms-server/src/main/java/com/zheng/upms/server/controller/SSOController.java#L61-L97","documentation":"SSOController.index throws RuntimeException(String.format(\"未注册的系统:%s\", appid)) when the supplied appid has no matching row in upms_system (countByExample returns 0). The auth center only serves SSO for client systems registered in the UPMS database.","triggerScenarios":"GET /sso/index?appid=foo where no upms_system row has name == 'foo', so count == 0.","commonSituations":"Typo or wrong-case appid in the client configuration; client system was never registered in the auth center's admin UI; environment (dev/staging/prod) database lacks the system record; system was renamed or deleted.","solutions":["Register the client system in UPMS (insert into upms_system with name equal to the appid sent by the client).","Make the client's configured appid exactly match the registered system name (case/whitespace included).","Verify you are pointing at the right environment database that contains the system record.","Catch the RuntimeException in an exception handler and render a clear 'unregistered system' page."],"exampleFix":"// before\n// client sends appid=mysys but DB has no row named 'mysys' -> 500\n// after\nINSERT INTO upms_system (name, title, description, ...) VALUES ('mysys', 'My System', '...', ...);","handlingStrategy":"validation","validationCode":"UpmsSystemExample ex = new UpmsSystemExample();\nex.createCriteria().andNameEqualTo(appid);\nif (upmsSystemService.countByExample(ex) == 0) {\n    throw new IllegalStateException(\"System not registered: \" + appid);\n}","typeGuard":"boolean isRegisteredSystem(String appid) {\n    UpmsSystemExample e = new UpmsSystemExample();\n    e.createCriteria().andNameEqualTo(appid);\n    return upmsSystemService.countByExample(e) > 0;\n}","tryCatchPattern":"try {\n    return ssoController.index(request);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"未注册的系统\")) {\n        return \"error/unregistered-system\";\n    }\n    throw e;\n}","preventionTips":["Register every client system in upms_system before enabling SSO for it.","Keep appid configuration per environment in sync with that environment's database.","Use exact-match naming for appid (avoid case/whitespace drift); consider trimming both sides.","Add a deployment check that verifies each configured appid exists in the target DB.","Catch the RuntimeException and return a clear 'unregistered system' page instead of a 500."],"tags":["sso","http","unregistered-system","configuration"],"backgroundTag":"unregistered-sso-client","analyzedSha":"7005c0a775e6d014d1dc8a8a809f7b1c13bf785a","analyzedAt":"2026-09-04T16:58:32.852Z","contentChangedAt":"2026-09-04T16:58:32.852Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}