{"id":18552056,"url":"https://github.com/baraja-core/structured-api-token-authorizator","last_synced_at":"2025-04-09T22:31:48.846Z","repository":{"id":44662271,"uuid":"325274944","full_name":"baraja-core/structured-api-token-authorizator","owner":"baraja-core","description":"A simple token authorizer for authenticating HTTP requests.","archived":false,"fork":false,"pushed_at":"2024-06-09T20:14:04.000Z","size":31,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T13:05:11.598Z","etag":null,"topics":["api","api-authorizator","auth","authorizator","baraja","register","token"],"latest_commit_sha":null,"homepage":"https://php.baraja.cz","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/baraja-core.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"janbarasek","custom":["https://brj.app","https://baraja.cz","https://php.baraja.cz"]}},"created_at":"2020-12-29T12:00:03.000Z","updated_at":"2024-06-09T20:14:07.000Z","dependencies_parsed_at":"2024-06-09T21:35:09.194Z","dependency_job_id":"c7f17010-2879-4a44-b4d8-a0831d396506","html_url":"https://github.com/baraja-core/structured-api-token-authorizator","commit_stats":{"total_commits":23,"total_committers":3,"mean_commits":7.666666666666667,"dds":"0.17391304347826086","last_synced_commit":"1450ddda9f50b600b5e64da20140f0dfd951e645"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baraja-core%2Fstructured-api-token-authorizator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baraja-core%2Fstructured-api-token-authorizator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baraja-core%2Fstructured-api-token-authorizator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baraja-core%2Fstructured-api-token-authorizator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baraja-core","download_url":"https://codeload.github.com/baraja-core/structured-api-token-authorizator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248123709,"owners_count":21051516,"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":["api","api-authorizator","auth","authorizator","baraja","register","token"],"created_at":"2024-11-06T21:12:14.075Z","updated_at":"2025-04-09T22:31:48.834Z","avatar_url":"https://github.com/baraja-core.png","language":"PHP","funding_links":["https://github.com/sponsors/janbarasek","https://brj.app","https://baraja.cz","https://php.baraja.cz"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align='center'\u003e\n  \u003cpicture\u003e\n    \u003csource media='(prefers-color-scheme: dark)' srcset='https://cdn.brj.app/images/brj-logo/logo-regular.png'\u003e\n    \u003cimg src='https://cdn.brj.app/images/brj-logo/logo-dark.png' alt='BRJ logo'\u003e\n  \u003c/picture\u003e\n  \u003cbr\u003e\n  \u003ca href=\"https://brj.app\"\u003eBRJ organisation\u003c/a\u003e\n\u003c/div\u003e\n\u003chr\u003e\n\nStructured API token authorizator\n=================================\n\n![Integrity check](https://github.com/baraja-core/structured-api-token-authorizator/workflows/Integrity%20check/badge.svg)\n\nA simple token authorizer for authenticating HTTP requests.\n\nThis package is the official extension for the [Baraja Structured API](https://github.com/baraja-core/structured-api).\n\n📦 Installation\n---------------\n\nIt's best to use [Composer](https://getcomposer.org) for installation, and you can also find the package on\n[Packagist](https://packagist.org/packages/baraja-core/structured-api-token-authorizator) and\n[GitHub](https://github.com/baraja-core/structured-api-token-authorizator).\n\nTo install, simply use the command:\n\n```shell\n$ composer require baraja-core/structured-api-token-authorizator\n```\n\nYou can use the package manually by creating an instance of the internal classes, or register a DIC extension to link the services directly to the Nette Framework.\n\nSimple usage\n------------\n\nInstall this package using Composer and register the DIC extension (if you use [Baraja Package manager](https://github.com/baraja-core/package-manager), it will be registered automatically).\n\nExtension definition for manual usage:\n\n```yaml\nextensions:\n   tokenAuthorizator: Baraja\\TokenAuthorizator\\TokenAuthorizatorExtension\n```\n\nThe package automatically disables the default system method of authenticating requests through Nette User and will require token authentication.\n\nA token is any valid string in the query parameter `token`, or in BODY (in the case of a POST request). The token evaluates as an endpoint call parameter and can be passed to the target endpoint as a string.\n\nRequest verification\n--------------------\n\nIf you are not using your own token authentication implementation, the default `SimpleStrategy` will be used, which you can configure the token via NEON configuration.\n\nIf you do not set a token, all requests (even without a token) will be considered valid.\n\nSimple configuration example:\n\n```yaml\ntokenAuthorizator:\n   token: abcd\n```\n\nThis configuration accepts requests as: `/api/v1/user?token=abcd`.\n\nToken verification at the endpoint level\n----------------------------------------\n\nToken usage is verified at the endpoint level. By default, all endpoints have access enabled and are governed by the `PublicEndpoint` attribute defined by the baraja-core/structured-api package.\n\nIf you want to require token authentication in your endpoint, set the attribute directly above the endpoint definition.\n\nFor example:\n\n```php\n#[PublicEndpoint(requireToken: true)]\nclass ArticleEndpoint extends BaseEndpoint\n{\n}\n```\n\nCustom authentication\n---------------------\n\nIf you need more complex authentication logic, implement a service that implements the `VerificationStrategy` interface and register it with the DIC. This service will be called automatically when all requests are verified.\n\n📄 License\n-----------\n\n`baraja-core/structured-api-token-authorizator` is licensed under the MIT license. See the [LICENSE](https://github.com/baraja-core/structured-api-token-authorizator/blob/master/LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaraja-core%2Fstructured-api-token-authorizator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaraja-core%2Fstructured-api-token-authorizator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaraja-core%2Fstructured-api-token-authorizator/lists"}