{"id":14967367,"url":"https://github.com/gevorg/http-auth","last_synced_at":"2025-05-15T01:05:35.316Z","repository":{"id":1679856,"uuid":"2407084","full_name":"gevorg/http-auth","owner":"gevorg","description":"Node.js package for HTTP basic and digest access authentication.","archived":false,"fork":false,"pushed_at":"2025-05-02T09:05:33.000Z","size":887,"stargazers_count":368,"open_issues_count":3,"forks_count":70,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-02T10:20:12.690Z","etag":null,"topics":["crypt","digest","digest-access","http","javascript","mocha","passhash","passport","protection","realm"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/gevorg.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}},"created_at":"2011-09-17T22:37:44.000Z","updated_at":"2025-05-02T09:05:29.000Z","dependencies_parsed_at":"2024-08-23T14:34:27.720Z","dependency_job_id":null,"html_url":"https://github.com/gevorg/http-auth","commit_stats":{"total_commits":351,"total_committers":26,"mean_commits":13.5,"dds":"0.15954415954415957","last_synced_commit":"4158fa75f58de70fd44aa68876a8674725e0556e"},"previous_names":[],"tags_count":105,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gevorg%2Fhttp-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gevorg%2Fhttp-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gevorg%2Fhttp-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gevorg%2Fhttp-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gevorg","download_url":"https://codeload.github.com/gevorg/http-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254254039,"owners_count":22039792,"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":["crypt","digest","digest-access","http","javascript","mocha","passhash","passport","protection","realm"],"created_at":"2024-09-24T13:37:56.327Z","updated_at":"2025-05-15T01:05:35.291Z","avatar_url":"https://github.com/gevorg.png","language":"JavaScript","readme":"# http-auth\n[Node.js](http://nodejs.org/) package for HTTP basic and digest access authentication.\n\n[![build](https://github.com/gevorg/http-auth/workflows/build/badge.svg)](https://github.com/gevorg/http-auth/actions/workflows/build.yml)\n\n## Installation\n\nVia git (or downloaded tarball):\n\n```bash\n$ git clone git@github.com:gevorg/http-auth.git\n```\nVia [npm](http://npmjs.org/):\n\n```bash\n$ npm install http-auth\n```    \n\n## Usage\n\n```javascript\n// HTTP module\nconst http = require(\"http\");\n\n// Authentication module.\nconst auth = require(\"http-auth\");\nconst basic = auth.basic({\n  realm: \"Simon Area.\",\n  file: __dirname + \"/../data/users.htpasswd\" // gevorg:gpass, Sarah:testpass\n});\n\n// Creating new HTTP server.\nhttp\n  .createServer(\n    basic.check((req, res) =\u003e {\n      res.end(`Welcome to private area - ${req.user}!`);\n    })\n  )\n  .listen(1337, () =\u003e {\n    // Log URL.\n    console.log(\"Server running at http://127.0.0.1:1337/\");\n  });\n```\n\nPlease check [examples directory](./examples) for more.\n\n## Configurations\n\n - `realm` - Authentication realm, by default it is **Users**.\n - `file` - File where user details are stored.\n     - Line format is **{user:pass}** or **{user:passHash}** for basic access. \n     - Line format is **{user:realm:passHash}** for digest access.\n     - Using a callback, it needs to return the same line format, example: `file: () =\u003e 'adam:adam\\neve:eve',`\n - `algorithm` - Algorithm that will be used only for **digest** access authentication.\n     - **MD5** by default.\n     - **MD5-sess** can be set.\n - `qop` - Quality of protection that is used only for **digest** access authentication.\n     - **auth** is set by default.\n     - **none** this option is disabling protection.\n - `msg401` - Message for failed authentication 401 page.\n - `msg407` - Message for failed authentication 407 page.\n - `contentType` - Content type for failed authentication page.\n - `skipUser` - Set this to **true**, if you don't want req.user to be filled with authentication info.\n - `proxy` - Set this to **true**, if you want to use it with [http-proxy](https://github.com/http-party/node-http-proxy).\n\n## Running tests\n\nIt uses [mocha](https://mochajs.org/), so just run following command in package directory:\n\n```bash\n$ npm test\n```\n\n## Questions\n\nYou can also use [stackoverflow](http://stackoverflow.com/questions/tagged/http-auth) to ask questions using **[http-auth](http://stackoverflow.com/tags/http-auth/info)** tag.\n\n## Utilities\n\n - **[htpasswd](https://github.com/gevorg/htpasswd/)** - Node.js package for HTTP Basic Authentication password file utility.\n - **[htdigest](https://github.com/gevorg/htdigest/)** - Node.js package for HTTP Digest Authentication password file utility.\n\n## Integrations\n\nPlease check [this link](https://github.com/http-auth) for integration packages.\n\n## License\n\nThe MIT License (MIT)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgevorg%2Fhttp-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgevorg%2Fhttp-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgevorg%2Fhttp-auth/lists"}