{"id":30687755,"url":"https://github.com/lanaqi-opensource/react-security-router","last_synced_at":"2026-04-10T23:11:55.046Z","repository":{"id":284300261,"uuid":"938497143","full_name":"lanaqi-opensource/react-security-router","owner":"lanaqi-opensource","description":"React 纯前端路由级别控制的安全框架","archived":false,"fork":false,"pushed_at":"2025-05-16T02:33:13.000Z","size":43,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-24T15:10:33.573Z","etag":null,"topics":["react","react-router","react-security","security-router"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@lanaqi/rsr","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lanaqi-opensource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-25T03:42:52.000Z","updated_at":"2025-05-16T09:15:35.000Z","dependencies_parsed_at":"2025-03-25T07:34:12.304Z","dependency_job_id":"b9bc7977-9d01-4b29-80d4-c7b25d2725ea","html_url":"https://github.com/lanaqi-opensource/react-security-router","commit_stats":null,"previous_names":["lanaqi-opensource/react-security-router"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lanaqi-opensource/react-security-router","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanaqi-opensource%2Freact-security-router","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanaqi-opensource%2Freact-security-router/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanaqi-opensource%2Freact-security-router/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanaqi-opensource%2Freact-security-router/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lanaqi-opensource","download_url":"https://codeload.github.com/lanaqi-opensource/react-security-router/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lanaqi-opensource%2Freact-security-router/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273208777,"owners_count":25064204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","react-router","react-security","security-router"],"created_at":"2025-09-02T00:06:37.260Z","updated_at":"2026-04-10T23:11:55.002Z","avatar_url":"https://github.com/lanaqi-opensource.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Security Router\n\nReact 安全路由器\n\n# 如何安装\n\n```bash\n\nnpm add @lanaqi/rsr -S\n\n```\n\n# 框架说明\n\nrsr 是 react security router 的简写，一个基于 react router 实现纯前端路由级别控制的安全框架。\n\n功能简介：\n\n- 认证与授权\n- 权限检测\n- 二次签证（签名：如要求再次输入密码等）\n- 等等\n\n注意: 该框架没有编写相关文档，需要自行看源码（注释）和例子。\n\n# 版本兼容\n\n注意：目前 0.0.3 + 版本只支持 react 19 + ，另外兼容 react router v6 / v7 版本，其它的版本，暂时不考虑兼容。\n\n# 简单例子\n\n```tsx\nexport default withSecurityBlocker(Root, (bundler) =\u003e {\n  return (\n    bundler\n      .context((builder) =\u003e {\n        return (\n          builder\n            // 可选层级权限\n            // .hierarchy('superadmin\u003eadmin;admin\u003eusers;users\u003eguest')\n            .resource((rb) =\u003e\n              rb\n                .patterns(\"/login\", \"/logout\", \"/denied\", \"/signature\")\n                .anonymous()\n                .build(),\n            )\n            .resource((rb) =\u003e\n              rb.patterns(\"/sheet\").permissions(\"admin\").signatured().build(),\n            )\n            .resource((rb) =\u003e rb.patterns(\"/*\").authenticated().build())\n            .build()\n        );\n      })\n      .manager((builder) =\u003e {\n        return builder\n          .behave({\n            notAuthenticationPath: \"/login\",\n            notSignaturePath: \"/signature\",\n            accessDeniedPath: \"/denied\",\n          })\n          .build();\n      })\n      // .addons()\n      .build()\n  );\n});\n```\n\n# 其它例子\n\n基于 Modern.js 的例子：https://github.com/lanaqi-opensource/rsr-demo\n\n基于 react-router-dom 的例子：https://github.com/lanaqi-opensource/rsr6-demo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flanaqi-opensource%2Freact-security-router","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flanaqi-opensource%2Freact-security-router","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flanaqi-opensource%2Freact-security-router/lists"}