{"id":21819370,"url":"https://github.com/dflydev/dflydev-stack-basic-authentication","last_synced_at":"2025-04-14T02:29:14.913Z","repository":{"id":9798793,"uuid":"11776876","full_name":"dflydev/dflydev-stack-basic-authentication","owner":"dflydev","description":"HTTP Basic Authentication Stack middleware","archived":false,"fork":false,"pushed_at":"2018-02-12T11:03:32.000Z","size":178,"stargazers_count":12,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-03T16:29:15.076Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/dflydev.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":"2013-07-30T22:18:38.000Z","updated_at":"2023-06-02T10:12:38.000Z","dependencies_parsed_at":"2022-08-25T23:31:27.504Z","dependency_job_id":null,"html_url":"https://github.com/dflydev/dflydev-stack-basic-authentication","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-stack-basic-authentication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-stack-basic-authentication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-stack-basic-authentication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-stack-basic-authentication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dflydev","download_url":"https://codeload.github.com/dflydev/dflydev-stack-basic-authentication/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226779851,"owners_count":17680772,"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-27T16:18:42.619Z","updated_at":"2024-11-27T16:18:43.525Z","avatar_url":"https://github.com/dflydev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"HTTP Basic Authentication Stack Middleware\n==========================================\n\nA [Stack][0] middleware to enable [HTTP Basic Authentication][1] following the\n[STACK-2 Authentication][2] conventions.\n\n\nInstallation\n------------\n\nThrough [Composer][3] as [dflydev/stack-basic-authentication][4].\n\n\nUsage\n-----\n\nThe BasicAuthentication middleware accepts the following options:\n\n * **authenticator**: *(required)* A callback used to ensure that the specified\n   credentials are correct.\n * **realm**: The HTTP Basic Authentication realm as defined by [RFC1945][5].\n * **firewall**: A firewall configuration compatible with\n   [dflydev/stack-firewall][6].\n\n```php\n\u003c?php\n\n$authenticator = function ($username, $password) {\n    // Given a username and password credentials, ensure that\n    // the credentials are correct and return a token that\n    // represents the user for this request.\n    if ('admin' === $username \u0026\u0026 'default' === $password) {\n        return 'admin-user-token';\n    }\n};\n\n$app = new Dflydev\\Stack\\BasicAuthentication($app, [\n    'firewall' =\u003e [\n        ['path' =\u003e '/', 'anonymous' =\u003e true],\n        ['path' =\u003e '/login'],\n    ],\n    'authenticator' =\u003e $authenticator,\n    'realm' =\u003e 'here there be dragons',\n]);\n```\n\nExamples\n--------\n\nSee the `examples/` directory for some live examples of this middleware in\naction.\n\n\nLicense\n-------\n\nMIT, see LICENSE.\n\n\nCommunity\n---------\n\nIf you have questions or want to help out, join us in the **#stackphp** or **#dflydev** channels on **irc.freenode.net**.\n\n\n[0]: http://stackphp.com/\n[1]: http://en.wikipedia.org/wiki/Basic_access_authentication\n[2]: http://stackphp.com/specs/STACK-2/\n[3]: http://getcomposer.org\n[4]: https://packagist.org/packages/dflydev/stack-basic-authentication\n[5]: http://tools.ietf.org/html/rfc1945#section-11\n[6]: https://packagist.org/packages/dflydev/stack-firewall\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflydev%2Fdflydev-stack-basic-authentication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdflydev%2Fdflydev-stack-basic-authentication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflydev%2Fdflydev-stack-basic-authentication/lists"}