{"id":20367955,"url":"https://github.com/ksoichiro/ability","last_synced_at":"2026-06-09T05:01:55.496Z","repository":{"id":31803584,"uuid":"35370160","full_name":"ksoichiro/ability","owner":"ksoichiro","description":"Simple authorization library for Java.","archived":false,"fork":false,"pushed_at":"2015-05-24T14:17:47.000Z","size":212,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-04T19:44:23.536Z","etag":null,"topics":["java"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ksoichiro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-10T12:32:51.000Z","updated_at":"2024-04-02T17:41:56.000Z","dependencies_parsed_at":"2022-08-25T15:51:02.191Z","dependency_job_id":null,"html_url":"https://github.com/ksoichiro/ability","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ksoichiro/ability","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksoichiro%2Fability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksoichiro%2Fability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksoichiro%2Fability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksoichiro%2Fability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksoichiro","download_url":"https://codeload.github.com/ksoichiro/ability/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksoichiro%2Fability/sbom","scorecard":{"id":571515,"data":{"date":"2025-08-11","repo":{"name":"github.com/ksoichiro/ability","commit":"7183598bcc5ff2077f032d27f8fcc4cab1030266"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/12 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":7,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1","Warn: binary detected: samples/simple/gradle/wrapper/gradle-wrapper.jar:1","Warn: binary detected: samples/spring/gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-20T16:28:24.696Z","repository_id":31803584,"created_at":"2025-08-20T16:28:24.697Z","updated_at":"2025-08-20T16:28:24.697Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34092262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"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":["java"],"created_at":"2024-11-15T00:35:47.694Z","updated_at":"2026-06-09T05:01:55.435Z","avatar_url":"https://github.com/ksoichiro.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ability\n\n[![Build Status](https://travis-ci.org/ksoichiro/ability.svg?branch=master)](https://travis-ci.org/ksoichiro/ability)\n[![Maven Central](http://img.shields.io/maven-central/v/com.github.ksoichiro/ability.svg?style=flat)](https://github.com/ksoichiro/ability/releases/latest)\n\nSimple authorization library for Java.\n\n## Usage\n\n### Add dependency\n\n```groovy\nrepositories {\n    mavenCentral()\n}\ndependencies {\n    compile \"com.github.ksoichiro:ability:0.0.1\"\n}\n```\n\nOr snapshot:\n\n```groovy\nrepositories {\n    maven {\n        url uri('https://oss.sonatype.org/content/repositories/snapshots/')\n    }\n}\ndependencies {\n    compile \"com.github.ksoichiro:ability:0.0.1-SNAPSHOT\"\n}\n```\n\n### Create rules\n\nModel class implements `Rule` interface and implements `allowed` method.\n\n```java\npublic class Book implements Rule {\n    enum Actions {\n        READ,\n        EDIT,\n    }\n\n    private boolean published;\n    private User author;\n\n    @Override\n    public Set\u003cString\u003e allowed(Object object, Object subject) {\n        Set\u003cString\u003e rules = new HashSet\u003cString\u003e();\n        if (subject == null || !(subject instanceof Book) || object == null || !(object instanceof User)) {\n            return rules;\n        }\n        User user = (User) object;\n        Book book = (Book) subject;\n        if (book.published) {\n            rules.add(Actions.READ.name());\n        }\n        if (book.author != null \u0026\u0026 book.author.getId() == user.getId()) {\n            rules.add(Actions.EDIT.name());\n        }\n        return rules;\n    }\n    // Getters and setters are omitted\n}\n```\n\n### Add rules\n\nUser class has `Ability` instance and add some authorization methods.\n\n```java\npublic class User {\n    private Ability ability;\n    public User() {\n        ability = new Ability();\n        ability.addRule(Book.class);\n    }\n\n    public boolean can(String action, Object subject) {\n        return ability.allowed(this, action, subject);\n    }\n\n    public boolean canReadBook(Book subject) {\n        return ability.allowed(this, Book.Actions.READ.name(), subject);\n    }\n    // Other unimportant codes are omitted\n}\n```\n\n### Use\n\n```java\nUser user1 = new User(1);\nUser user2 = new User(2);\nBook book1 = new Book();\nbook1.setAuthor(user1);\nbook1.setPublished(true);\nBook book2 = new Book();\n\nassertTrue(user1.canReadBook(book1));\n\nassertTrue(user1.can(Book.Actions.EDIT.name(), book1));\nassertFalse(user2.can(Book.Actions.EDIT.name(), book1));\n\n// Or you can directly use it\nAbility ability = new Ability();\nability.addRule(Book.class);\nassertTrue(ability.allowed(user1, Book.Actions.READ.name(), book1));\n```\n\n## Thanks\n\n* Inspired by [Six](https://github.com/randx/six), which is used in GitLab\n\n## License\n\n    Copyright 2015 Soichiro Kashima\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksoichiro%2Fability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksoichiro%2Fability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksoichiro%2Fability/lists"}