{"id":18832634,"url":"https://github.com/datto/php-json-rpc-auth","last_synced_at":"2025-10-30T00:14:25.574Z","repository":{"id":56963144,"uuid":"47975966","full_name":"datto/php-json-rpc-auth","owner":"datto","description":"Authentication \u0026 authorization extension for the JSON-RPC library ","archived":false,"fork":false,"pushed_at":"2015-12-15T20:03:19.000Z","size":12,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T14:50:03.542Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-14T13:13:33.000Z","updated_at":"2020-11-17T02:42:15.000Z","dependencies_parsed_at":"2022-08-21T09:50:41.259Z","dependency_job_id":null,"html_url":"https://github.com/datto/php-json-rpc-auth","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datto%2Fphp-json-rpc-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datto%2Fphp-json-rpc-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datto%2Fphp-json-rpc-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datto%2Fphp-json-rpc-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datto","download_url":"https://codeload.github.com/datto/php-json-rpc-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248820172,"owners_count":21166616,"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-08T01:58:34.580Z","updated_at":"2025-10-30T00:14:25.499Z","avatar_url":"https://github.com/datto.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON-RPC Auth Extension\n\nThis is an authentication and authorization extension for the [php-json-rpc](https://github.com/datto/php-json-rpc) library. It provides the ability to authorize JSON-RPC requests before they reach the endpoint. \n\nExamples\n--------\nFirst write an authentication `Handler`:\n\n```php\nnamespace Datto\\JsonRpc\\Auth;\n\nuse Datto\\JsonRpc;\n\nclass BasicAuthHandler implements Handler\n{\n    public function canHandle($method, $arguments)\n    {\n        return isset($_SERVER['PHP_AUTH_USER']);\n    }\n\n    public function authenticate($method, $arguments)\n    {\n        // Don't do this in production. Using '===' is vulnerable to timing attacks!\n        return $_SERVER['PHP_AUTH_USER'] === 'phil' \u0026\u0026 $_SERVER['PHP_AUTH_PW'] === 'superpass!';\n    }\n}\n```\n\nOnce you have that, just use it like this. This example uses the `Simple\\Evaluator` (see [php-json-rpc-simple](https://github.com/datto/php-json-rpc-simple)) as underlying mapping mechanism:\n\n```php\n$authenticator = new Authenticator(array(\n    new BasicAuthHandler(),\n    // ...\n));\n\n$server = new Server(new Auth\\Evaluator(new Simple\\Evaluator(), $authenticator));\necho $server-\u003ereply('...');\n```\n\nRequirements\n------------\n* PHP \u003e= 5.3\n\nInstallation\n------------\n```javascript\n\"require\": {\n  \"datto/json-rpc-auth\": \"~4.0\"\n}\n```   \n\nLicense\n-------\nThis package is released under an open-source license: [LGPL-3.0](https://www.gnu.org/licenses/lgpl-3.0.html).\n\nAuthor\n------\nWritten by Chad Kosie and [Philipp C. Heckel](https://github.com/binwiederhier).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatto%2Fphp-json-rpc-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatto%2Fphp-json-rpc-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatto%2Fphp-json-rpc-auth/lists"}