{"id":22965581,"url":"https://github.com/buession/buession-shirojs","last_synced_at":"2026-02-27T06:17:12.834Z","repository":{"id":57150078,"uuid":"434431320","full_name":"buession/buession-shirojs","owner":"buession","description":" A security framework for JavaScript or TypeScript.","archived":false,"fork":false,"pushed_at":"2025-05-19T09:13:52.000Z","size":539,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T10:43:15.633Z","etag":null,"topics":["authentication","authorization","javascript","permission","privilege","security","shiro","typescript","vue"],"latest_commit_sha":null,"homepage":"https://shirojs.buession.com/","language":"SCSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buession.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2021-12-03T01:41:01.000Z","updated_at":"2025-05-19T09:12:38.000Z","dependencies_parsed_at":"2024-10-14T00:01:23.525Z","dependency_job_id":"04b89e82-deca-4ca5-a35d-6db375904fe2","html_url":"https://github.com/buession/buession-shirojs","commit_stats":{"total_commits":23,"total_committers":4,"mean_commits":5.75,"dds":"0.34782608695652173","last_synced_commit":"e45fbd64f1c51019c8e6bf02a1a1637d2ddf1116"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/buession/buession-shirojs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buession%2Fbuession-shirojs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buession%2Fbuession-shirojs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buession%2Fbuession-shirojs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buession%2Fbuession-shirojs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buession","download_url":"https://codeload.github.com/buession/buession-shirojs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buession%2Fbuession-shirojs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29887018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T05:38:26.446Z","status":"ssl_error","status_checked_at":"2026-02-27T05:38:25.235Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["authentication","authorization","javascript","permission","privilege","security","shiro","typescript","vue"],"created_at":"2024-12-14T20:15:10.779Z","updated_at":"2026-02-27T06:17:12.816Z","avatar_url":"https://github.com/buession.png","language":"SCSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eBuession Shiro\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cp align=\"center\"\u003eTypescript 或者 JavaScript 的权限验证库\u003c/p\u003e\n  \u003ca href=\"https://codecov.io/github/buession/buession-shirojs?branch=master\"\u003e\n    \u003cimg src=\"https://img.shields.io/codecov/c/github/buession/buession-shirojs?token=tp73oo63nf\" alt=\"Coverage Status\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/buession/buession-shirojs/actions/workflows/codecov.yml\"\u003e\n    \u003cimg src=\"https://github.com/buession/buession-shirojs/actions/workflows/codecov.yml/badge.svg\" alt=\"Codecov\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/buession/buession-shirojs/actions/workflows/codeql-analysis.yml\"\u003e\n    \u003cimg src=\"https://github.com/buession/buession-shirojs/actions/workflows/codeql-analysis.yml/badge.svg\" alt=\"CodeQL\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@buession/shiro\"\u003e\n    \u003cimg src=\"https://img.shields.io/bundlephobia/minzip/@buession/shiro/latest\" alt=\"Size\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@buession/shiro\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@buession/shiro\" alt=\"Version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@buession/shiro\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/languages/top/buession/buession-shirojs\" alt=\"Languages\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@buession/shiro\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/l/@buession/shiro\" alt=\"License\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/buession/buession-shirojs/stargazers\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/buession/buession-shirojs\" alt=\"Star\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@buession/shiro\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/@buession/shiro\" alt=\"Download\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@buession/shiro\"\u003e\n    \u003cimg src=\"https://img.shields.io/snyk/vulnerabilities/npm/@buession/shiro\" alt=\"Vulnerabilities\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n## 为什么选择 Buession Shiro\n\n在前后端分离项目中（如：Vue、Angular、React等），前端常常涉及到根据权限显示数据、操作等等重复的实现所困惑。每当开启一个新项目时，我们都得手动重复去编写这些代码，而且还难免代码逻辑不一致，质量参差不齐。\n\nBuession ShiroJs 旨在提供便捷的、统一的、可靠的权限前端权限验证功能。在业务开发中省去的那些“脏活累活”，专注于业务核心的开发。\n\nBuession ShiroJs 的核心思想参考 [Apache Shiro](http://shiro.apache.org/) 。\n\n## 安装\n\n您可以通过 [NPM](https://www.npmjs.com/)、[YARN](https://yarnpkg.com/) 或者通过 `\u003cscript\u003e` 的方式引入 [unpkg.com](https://unpkg.com/) 上的包。\n\n### NPM\n\n```sh\nnpm install @buession/shiro\n# or\nyarn add @buession/shiro\n```\n\n### CDN\n\n\u003e 对于生产环境，我们推荐链接到一个明确的版本号和构建文件，以避免新版本造成的不可预期的破坏。\n\n```html\n最新版：\u003cscript src=\"https://unpkg.com/@buession/shiro/dist/shiro.min.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\n具体版本：\u003cscript src=\"https://unpkg.com/@buession/shiro@版本/dist/shiro.min.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\n```\n\n## 示例\n\n```vue\n\u003ctemplate\u003e\n  \u003cdiv\u003e\n    \u003cdiv v-if=\"shiro.hasRole('admin')\"\u003eAdmin\u003c/div\u003e\n    \u003cdiv v-if=\"shiro.hasPermission('user:edit')\"\u003eEdit\u003c/div\u003e\n    \u003cdiv v-if=\"shiro.hasPermissions(['user:add', 'user:edit'])\"\u003eAction\u003c/div\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript lang=\"ts\"\u003e\nimport { defineComponent } from 'vue';\nexport default defineComponent({\n  setup() {\n  }\n});\n\u003c/script\u003e\n```\n\n\n```javascript\n\u003cscript type=\"text/javascript\"\u003e\n  function Principal(){\n    this.id = '1';\n  }\n\n  Principal.prototype.getId = function(){\n    return this.id;\n  }\n\n  Principal.prototype.getRoles = function(){\n    return [\"admin\", \"admin1\"];\n  }\n\n  Principal.prototype.getPermissions = function(){\n    return [\"user:add\", \"user:edit\"];\n  }\n\n  var shiro = new Shiro(new Principal());\n  if (shiro.hasRole(\"admin\")) {\n    \n  }\n\u003c/script\u003e\n```\n\n## License\n\n[MIT License](https://github.com/buession/buession-shirojs/blob/master/LICENSE) © 2020-2025","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuession%2Fbuession-shirojs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuession%2Fbuession-shirojs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuession%2Fbuession-shirojs/lists"}