{"id":20103126,"url":"https://github.com/dotkernel/dot-authorization","last_synced_at":"2025-05-06T08:31:09.257Z","repository":{"id":11026802,"uuid":"68037254","full_name":"dotkernel/dot-authorization","owner":"dotkernel","description":"DotKernel authorization service abstractions component","archived":false,"fork":false,"pushed_at":"2025-03-05T06:34:17.000Z","size":113,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"3.0","last_synced_at":"2025-04-26T23:36:06.839Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://docs.dotkernel.org/dot-authorization/","language":"PHP","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/dotkernel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-12T18:44:05.000Z","updated_at":"2025-03-05T06:32:24.000Z","dependencies_parsed_at":"2023-11-29T16:27:58.126Z","dependency_job_id":"ae83e308-ef49-40f0-9b15-7c4b8caaed61","html_url":"https://github.com/dotkernel/dot-authorization","commit_stats":{"total_commits":23,"total_committers":5,"mean_commits":4.6,"dds":0.6086956521739131,"last_synced_commit":"5878233a6f0d75af7b02a5b2d9c28ec41f709f6b"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-authorization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-authorization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-authorization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-authorization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotkernel","download_url":"https://codeload.github.com/dotkernel/dot-authorization/tar.gz/refs/heads/3.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252648535,"owners_count":21782405,"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","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":[],"created_at":"2024-11-13T17:34:22.960Z","updated_at":"2025-05-06T08:31:09.252Z","avatar_url":"https://github.com/dotkernel.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dot-authorization\n\nDotkernel authorization service abstractions.\n\n`dot-authorization` is Dotkernel's authorization base package which define interfaces for authorization services to be used with Dotkernel applications.\n\n## Documentation\n\nDocumentation is available at: https://docs.dotkernel.org/dot-authorization/.\n\n## Badges\n\n![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-authorization)\n![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-authorization/3.7.0)\n\n[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-authorization)](https://github.com/dotkernel/dot-authorization/issues)\n[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-authorization)](https://github.com/dotkernel/dot-authorization/network)\n[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-authorization)](https://github.com/dotkernel/dot-authorization/stargazers)\n[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-authorization)](https://github.com/dotkernel/dot-authorization/blob/3.0/LICENSE.md)\n\n[![Build Static](https://github.com/dotkernel/dot-authorization/actions/workflows/continuous-integration.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-authorization/actions/workflows/continuous-integration.yml)\n[![codecov](https://codecov.io/gh/dotkernel/dot-authorization/graph/badge.svg?token=ZBZDEA3LY8)](https://codecov.io/gh/dotkernel/dot-authorization)\n[![PHPStan](https://github.com/dotkernel/dot-authorization/actions/workflows/static-analysis.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-authorization/actions/workflows/static-analysis.yml)\n\n## Installation\n\nRun the following command in you project directory:\n\n```shell\ncomposer require dotkernel/dot-authorization\n```\n\nPlease note that usually this package will be installed as a dependency to a concrete implementation, so you won't need to add this to your project manually.\n\n## AuthorizationInterface\n\nDefines the interface that should be implemented by any authorization service, in order to work with Dotkernel applications. This is a result of the fact that, by default, any Dotkernel package which has to do with authorization is assuming that a service is registered in the service container using as service name this interface's FQN\n\n### Methods\n\n```php\npublic function isGranted(string $permission, array $roles = [], $context = null): bool;\n```\n\n* this is the only method that deals with authorization. Given a permission and a list of roles, should return a boolean value of true if at least one role has access to the requested permission. As you can see, we expect that the authorization service to be implemented as an RBAC.\n\n## RoleInterface\n\nDefines the interface that Role objects must implement. A role object should be able to retrieve its name, so this interface has only one method defined\n\n```php\npublic function getName(): string;\n```\n\n## IdentityInterface\n\nInterface that needs to be implemented by entities that support roles.\nThey should be able to retrieve their roles by defining a `getRoles()` method.\nThe roles should be an array of role names or role objects.\n\nThis package is suitable for RBAC style authorization.\nRoles can be flat or hierarchical, and they are assigned permissions.\nA role is granted if it has the required permission.\n\n## ForbiddenException\n\nException to be thrown when accessing content without having the required permissions.\nThis can be used withing an application to trigger a forbidden error and do a custom action(like displaying a forbidden page or redirecting).\nThis package does not define how you should handle such situations.\nThere is a concrete authorization implementation in [dot-rbac](https://github.com/dotkernel/dot-rbac) and a forbidden exception handler in [dot-rbac-guard](https://github.com/dotkernel/dot-rbac-guard) as Dotkernel default packages for authorization.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotkernel%2Fdot-authorization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotkernel%2Fdot-authorization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotkernel%2Fdot-authorization/lists"}