{"id":31908340,"url":"https://github.com/jscheffner/hapi-auth-any","last_synced_at":"2025-10-13T15:27:08.515Z","repository":{"id":35106478,"uuid":"198697834","full_name":"jscheffner/hapi-auth-any","owner":"jscheffner","description":"Hapi.js plugin to combine multiple different authentication strategies. It passes if one of them does.","archived":false,"fork":false,"pushed_at":"2025-09-22T15:40:12.000Z","size":58,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-22T17:45:17.640Z","etag":null,"topics":["authentication","hapijs","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jscheffner.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-24T19:28:55.000Z","updated_at":"2025-09-22T15:40:10.000Z","dependencies_parsed_at":"2024-06-18T21:44:59.133Z","dependency_job_id":"aa89d137-e75f-4a33-a502-19ce703200b0","html_url":"https://github.com/jscheffner/hapi-auth-any","commit_stats":{"total_commits":55,"total_committers":5,"mean_commits":11.0,"dds":0.4545454545454546,"last_synced_commit":"2554c65438ba812faa24af18b179fe1d3db89587"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/jscheffner/hapi-auth-any","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jscheffner%2Fhapi-auth-any","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jscheffner%2Fhapi-auth-any/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jscheffner%2Fhapi-auth-any/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jscheffner%2Fhapi-auth-any/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jscheffner","download_url":"https://codeload.github.com/jscheffner/hapi-auth-any/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jscheffner%2Fhapi-auth-any/sbom","scorecard":{"id":537741,"data":{"date":"2025-08-11","repo":{"name":"github.com/jscheffner/hapi-auth-any","commit":"495ad57306b0ee8a978c27d91b018b349037362b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.8,"checks":[{"name":"Maintained","score":5,"reason":"6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/jscheffner/hapi-auth-any/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/jscheffner/hapi-auth-any/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/jscheffner/hapi-auth-any/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/jscheffner/hapi-auth-any/codeql-analysis.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/jscheffner/hapi-auth-any/nodejs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/jscheffner/hapi-auth-any/nodejs.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/jscheffner/hapi-auth-any/publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/jscheffner/hapi-auth-any/publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/jscheffner/hapi-auth-any/publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/jscheffner/hapi-auth-any/publish.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:24","Warn: npmCommand not pinned by hash: .github/workflows/publish.yml:16","Info:   0 out of  10 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: ISC License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T07:24:41.084Z","repository_id":35106478,"created_at":"2025-08-20T07:24:41.084Z","updated_at":"2025-08-20T07:24:41.084Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015922,"owners_count":26085778,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["authentication","hapijs","javascript"],"created_at":"2025-10-13T15:26:55.920Z","updated_at":"2025-10-13T15:27:08.510Z","avatar_url":"https://github.com/jscheffner.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hapi-auth-any\n\n**hapi-auth-any** is a plugin for [hapi.js](https://hapijs.com/) which lets you combine multiple different authentication strategies. It passes if one of them does. Hapi already supports this out-of-the-box, but only if all of those strategies are based on different schemes. With *hapi-auth-any* you can combine various strategies that are based on the same scheme.\n\n**Only the credentials of the strategy that passes first are returned.**\n\n## Plugin Options\n\nThe plugin only accepts a single option at the moment. `strategies` is an array containing the names of the strategies to combine. Those names are the first argument passed to `server.auth.strategy` when registering the strategy.\n\n## Usage\n\nFor complete examples, have a look at the *examples* folder.\n\n#### 1. Install\n\nInstall the plugin with `npm install hapi-auth-any`.\n\n#### 2. Import\n\nImport `hapi-auth-any` and the plugins you need for the authentication strategies that you want to combine (in this example only `@hapi/basic`).\n\n```js\nconst authAny = require('hapi-auth-any')\nconst basic = require('@hapi/basic')\n```\n\nThen, create a Hapi server:\n\n```js\nconst hapi = require('@hapi/hapi')\n\nconst server = hapi.server({ port: 8080 })\n```\n\n#### 3. Register\n\nNow, register the plugins\n\n```js\nawait server.register([\n  anyAuth,\n  basic\n])\n````\n\nRegister the authentication strategies you want to combine.\n\n```js\nserver.auth.strategy('foo', 'basic', {...})\nserver.auth.strategy('bar', 'basic', {...})\n```\n\nFinally, register the `hapi-auth-any` strategy and pass the names of the strategies it should combine as its `strategies` option. You can set the strategy as the default strategy so it's used for all routes or set it per route.\n\n```js\nserver.auth.strategy('any', 'any', {\n  strategies: ['foo', 'bar'] \n})\n\nserver.auth.default('any')\n```\n\n## Debugging\n\nSometimes, the messages exposed to the end users are not enough to find the root of a problem, specifically if a strategy fails because of a server-side error.\n\nTo access the complete errors, including their stack, you can register an event listener:\n\n```js\nserver.events.on({ name: 'request', channels: 'internal' }, (request, event, tags) =\u003e {\n  if (tags.auth \u0026\u0026 tags.error) {\n    console.log(event.error)\n  }\n})\n```\n\nIn this, debugging `hapi-auth-any` isn't different from debugging other strategies. However, in order to preserve the errors that caused `hapi-auth-any` to fail, it throws an [AggregateError](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError), decorated with some [boom](https://github.com/hapijs/boom)-specific properties.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjscheffner%2Fhapi-auth-any","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjscheffner%2Fhapi-auth-any","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjscheffner%2Fhapi-auth-any/lists"}