├── .github ├── FUNDING.yml ├── workflows │ ├── node.js-eol.yml │ ├── node.js-eol-20190430.yml │ ├── node.js-eol-20140731.yml │ ├── node.js-eol-20230430.yml │ ├── nvm.yml │ ├── nvm-manual.yml │ └── node.js.yml ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md ├── etc ├── jsdoc.json └── stunnel.conf ├── support └── mk │ ├── jshint.mk │ ├── notes.mk │ ├── node.mk │ ├── testling.mk │ ├── coveralls.mk │ ├── vows.mk │ ├── browserify.mk │ ├── mocha.mk │ └── istanbul.mk ├── .gitignore ├── test ├── bootstrap │ └── node.js ├── package.test.js ├── verify.test.js └── strategy.test.js ├── Makefile ├── .npmignore ├── .jshintrc ├── CONTRIBUTING.md ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── lib ├── index.js └── strategy.js ├── package.json └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: jaredhanson 2 | -------------------------------------------------------------------------------- /etc/jsdoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["plugins/markdown"] 3 | } 4 | -------------------------------------------------------------------------------- /etc/stunnel.conf: -------------------------------------------------------------------------------- 1 | pid = 2 | 3 | [proxy] 4 | client = yes 5 | accept = 8080 6 | connect = registry.npmjs.org:443 7 | -------------------------------------------------------------------------------- /support/mk/jshint.mk: -------------------------------------------------------------------------------- 1 | JSHINT ?= jshint 2 | 3 | lint-jshint: 4 | $(JSHINT) $(SOURCES) 5 | 6 | 7 | .PHONY: lint-jshint 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | reports 3 | 4 | # Mac OS X 5 | .DS_Store 6 | 7 | # Node.js 8 | node_modules 9 | npm-debug.log 10 | -------------------------------------------------------------------------------- /support/mk/notes.mk: -------------------------------------------------------------------------------- 1 | NOTES ?= 'TODO|FIXME' 2 | 3 | notes: 4 | grep -Ern $(NOTES) $(SOURCES) $(TESTS) 5 | 6 | 7 | .PHONY: notes 8 | -------------------------------------------------------------------------------- /support/mk/node.mk: -------------------------------------------------------------------------------- 1 | node_modules: 2 | npm install 3 | 4 | clobber-node: 5 | rm -rf node_modules 6 | 7 | 8 | .PHONY: clobber-node 9 | -------------------------------------------------------------------------------- /support/mk/testling.mk: -------------------------------------------------------------------------------- 1 | TESTLING ?= testling 2 | 3 | test-testling: node_modules 4 | $(TESTLING) 5 | 6 | 7 | .PHONY: test-testling 8 | -------------------------------------------------------------------------------- /test/bootstrap/node.js: -------------------------------------------------------------------------------- 1 | var chai = require('chai') 2 | , passport = require('chai-passport-strategy'); 3 | 4 | chai.use(passport); 5 | 6 | 7 | global.expect = chai.expect; 8 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include node_modules/make-node/main.mk 2 | 3 | MOCHAFLAGS = --require ./test/bootstrap/node 4 | JSDOCFLAGS ?= -c etc/jsdoc.json 5 | 6 | 7 | # Perform self-tests. 8 | check: test 9 | -------------------------------------------------------------------------------- /support/mk/coveralls.mk: -------------------------------------------------------------------------------- 1 | COVERALLS ?= coveralls 2 | 3 | submit-istanbul-lcov-to-coveralls: 4 | cat $(ISTANBUL_LCOV_INFO_PATH) | $(COVERALLS) 5 | 6 | 7 | .PHONY: submit-istanbul-lcov-to-coveralls 8 | -------------------------------------------------------------------------------- /support/mk/vows.mk: -------------------------------------------------------------------------------- 1 | VOWS ?= ./node_modules/.bin/vows 2 | VOWS_REPORTER ?= --spec 3 | 4 | test-vows: node_modules 5 | NODE_PATH=$(NODE_PATH_TEST) \ 6 | $(VOWS) $(VOWS_REPORTER) $(TESTS) 7 | 8 | 9 | .PHONY: test-vows 10 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | README.md 2 | Makefile 3 | build/ 4 | docs/ 5 | examples/ 6 | reports/ 7 | support/ 8 | test/ 9 | 10 | # Mac OS X 11 | .DS_Store 12 | 13 | # Node.js 14 | .npmignore 15 | node_modules/ 16 | npm-debug.log 17 | 18 | # Git 19 | .git* 20 | -------------------------------------------------------------------------------- /support/mk/browserify.mk: -------------------------------------------------------------------------------- 1 | BROWSERIFY ?= browserify 2 | BROWSERIFY_MAIN ?= index.js 3 | BROWSERIFY_OUT ?= build/bundle.js 4 | 5 | build-browserify: node_modules 6 | mkdir -p build 7 | $(BROWSERIFY) $(BROWSERIFY_MAIN) -o $(BROWSERIFY_OUT) 8 | 9 | 10 | .PHONY: build-browserify 11 | -------------------------------------------------------------------------------- /support/mk/mocha.mk: -------------------------------------------------------------------------------- 1 | MOCHA ?= ./node_modules/.bin/mocha 2 | _MOCHA ?= ./node_modules/.bin/_mocha 3 | MOCHA_REPORTER ?= spec 4 | MOCHA_REQUIRE ?= ./test/bootstrap/node 5 | 6 | test-mocha: node_modules 7 | NODE_PATH=$(NODE_PATH_TEST) \ 8 | $(MOCHA) \ 9 | --reporter $(MOCHA_REPORTER) \ 10 | --require $(MOCHA_REQUIRE) $(TESTS) 11 | 12 | 13 | .PHONY: test-mocha 14 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | 4 | "bitwise": true, 5 | "camelcase": true, 6 | "curly": true, 7 | "forin": true, 8 | "immed": true, 9 | "latedef": true, 10 | "newcap": true, 11 | "noarg": true, 12 | "noempty": true, 13 | "nonew": true, 14 | "quotmark": "single", 15 | "undef": true, 16 | "unused": true, 17 | "trailing": true, 18 | 19 | "laxcomma": true 20 | } 21 | -------------------------------------------------------------------------------- /test/package.test.js: -------------------------------------------------------------------------------- 1 | var pkg = require('..'); 2 | 3 | describe('passport-http-bearer', function() { 4 | 5 | it('should export Strategy constructor as module', function() { 6 | expect(pkg).to.be.a('function'); 7 | expect(pkg).to.equal(pkg.Strategy); 8 | }); 9 | 10 | it('should export Strategy constructor', function() { 11 | expect(pkg.Strategy).to.be.a('function'); 12 | }); 13 | 14 | }); 15 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | ### Tests 4 | 5 | The test suite is located in the `test/` directory. All new features are 6 | expected to have corresponding test cases with complete code coverage. Patches 7 | that increase test coverage are happily accepted. 8 | 9 | Ensure that the test suite passes by executing: 10 | 11 | ```bash 12 | $ make test 13 | ``` 14 | 15 | Coverage reports can be generated and viewed by executing: 16 | 17 | ```bash 18 | $ make test-cov 19 | $ make view-cov 20 | ``` 21 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: "node_js" 2 | node_js: 3 | - "11" 4 | - "10" 5 | - "9" 6 | - "8" 7 | - "7" 8 | - "6" 9 | - "5" 10 | - "4" 11 | - "3" # io.js 12 | - "2" # io.js 13 | - "1" # io.js 14 | - "0.12" 15 | - "0.10" 16 | - "0.8" 17 | 18 | 19 | # NOTE: `istanbul` and `coveralls` are pinned for compatibility with node 0.8. 20 | before_install: 21 | - "npm install -g istanbul@0.2.2" 22 | - "npm install -g coveralls@2.11.4" 23 | 24 | script: 25 | - "make check" 26 | 27 | after_success: 28 | - "make report-cov" 29 | 30 | sudo: false 31 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [Unreleased] 8 | ### Changed 9 | - Error message when constructed without a verify function changed to use 10 | "function" terminology, rather than "callback", in line with current Passport 11 | best practices. 12 | 13 | ## [1.0.1] - 2013-08-02 14 | 15 | ## [1.0.0] - 2013-08-01 16 | 17 | [Unreleased]: https://github.com/jaredhanson/passport-http-bearer/compare/v1.0.1...HEAD 18 | [1.0.1]: https://github.com/jaredhanson/passport-http-bearer/compare/v1.0.0...v1.0.1 19 | [1.0.0]: https://github.com/jaredhanson/passport-http-bearer/compare/v0.2.1...v1.0.0 20 | -------------------------------------------------------------------------------- /support/mk/istanbul.mk: -------------------------------------------------------------------------------- 1 | ISTANBUL ?= istanbul 2 | ISTANBUL_OUT ?= ./reports/coverage 3 | ISTANBUL_REPORT ?= lcov 4 | ISTANBUL_HTML_REPORT_PATH ?= $(ISTANBUL_OUT)/lcov-report/index.html 5 | ISTANBUL_LCOV_INFO_PATH ?= $(ISTANBUL_OUT)/lcov.info 6 | 7 | 8 | test-istanbul-mocha: node_modules 9 | NODE_PATH=$(NODE_PATH_TEST) \ 10 | $(ISTANBUL) cover \ 11 | --dir $(ISTANBUL_OUT) --report $(ISTANBUL_REPORT) \ 12 | $(_MOCHA) -- \ 13 | --reporter $(MOCHA_REPORTER) \ 14 | --require $(MOCHA_REQUIRE) $(TESTS) 15 | 16 | test-istanbul-vows: node_modules 17 | NODE_PATH=$(NODE_PATH_TEST) \ 18 | $(ISTANBUL) cover \ 19 | --dir $(ISTANBUL_OUT) --report $(ISTANBUL_REPORT) \ 20 | $(VOWS) $(VOWS_REPORTER) $(TESTS) 21 | 22 | view-istanbul-report: 23 | open $(ISTANBUL_HTML_REPORT_PATH) 24 | 25 | 26 | .PHONY: test-istanbul-mocha view-istanbul-report 27 | -------------------------------------------------------------------------------- /.github/workflows/node.js-eol.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs 3 | 4 | name: Node.js CI (EOL) 5 | 6 | on: 7 | push: 8 | branches: [ master ] 9 | pull_request: 10 | branches: [ master ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | matrix: 19 | node-version: [ 16.x ] 20 | 21 | steps: 22 | - uses: actions/checkout@v4 23 | - name: Use Node.js ${{ matrix.node-version }} 24 | uses: actions/setup-node@v4 25 | with: 26 | node-version: ${{ matrix.node-version }} 27 | - run: npm ci 28 | - run: npm test 29 | -------------------------------------------------------------------------------- /.github/workflows/node.js-eol-20190430.yml: -------------------------------------------------------------------------------- 1 | # This workflow performs continuous integration on node 8.x - 14.x, the last of 2 | # which reached end-of-life on 2023-04-30 according to the [release schedule][1] 3 | # published by the [release working group][2]. 4 | # 5 | # [1]: https://github.com/nodejs/release/blob/main/schedule.json 6 | # [2]: https://github.com/nodejs/release 7 | 8 | name: "Node.js CI (EOL: 2019-04-30)" 9 | 10 | on: 11 | push: 12 | branches: [ master ] 13 | pull_request: 14 | branches: [ master ] 15 | 16 | jobs: 17 | build: 18 | 19 | runs-on: ubuntu-20.04 20 | 21 | strategy: 22 | matrix: 23 | node-version: [ 6.x, 4.x, 0.12.x, 0.10.x ] 24 | 25 | # https://blog.npmjs.org/post/171556855892/introducing-npm-ci-for-faster-more-reliable 26 | steps: 27 | - uses: actions/checkout@v4 28 | - name: Use Node.js ${{ matrix.node-version }} 29 | uses: actions/setup-node@v4 30 | with: 31 | node-version: ${{ matrix.node-version }} 32 | - run: npm install 33 | - run: npm test 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2011-2013 Jared Hanson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /.github/workflows/node.js-eol-20140731.yml: -------------------------------------------------------------------------------- 1 | # This workflow performs continuous integration on node 8.x - 14.x, the last of 2 | # which reached end-of-life on 2023-04-30 according to the [release schedule][1] 3 | # published by the [release working group][2]. 4 | # 5 | # [1]: https://github.com/nodejs/release/blob/main/schedule.json 6 | # [2]: https://github.com/nodejs/release 7 | 8 | name: "Node.js CI (EOL: 2014-07-31)" 9 | 10 | on: 11 | push: 12 | branches: [ master ] 13 | pull_request: 14 | branches: [ master ] 15 | 16 | jobs: 17 | build: 18 | 19 | runs-on: ubuntu-latest 20 | 21 | strategy: 22 | matrix: 23 | node-version: [ 0.8.x ] 24 | 25 | # https://github.com/npm/npm/issues/20191 26 | # https://github.blog/security/supply-chain-security/npm-registry-deprecating-tls-1-0-tls-1-1/ 27 | steps: 28 | - uses: actions/checkout@v4 29 | - name: Use Node.js ${{ matrix.node-version }} 30 | uses: actions/setup-node@v4 31 | with: 32 | node-version: ${{ matrix.node-version }} 33 | - run: sudo apt-get install -y stunnel 34 | - run: stunnel etc/stunnel.conf 35 | - run: npm config set registry="http://registry.npmjs.org/" 36 | - run: npm config set proxy http://localhost:8080 37 | - run: npm install 38 | - run: npm test 39 | -------------------------------------------------------------------------------- /.github/workflows/node.js-eol-20230430.yml: -------------------------------------------------------------------------------- 1 | # This workflow performs continuous integration on node 8.x - 14.x, the last of 2 | # which reached end-of-life on 2023-04-30 according to the [release schedule][1] 3 | # published by the [release working group][2]. 4 | # 5 | # [1]: https://github.com/nodejs/release/blob/main/schedule.json 6 | # [2]: https://github.com/nodejs/release 7 | 8 | name: "Node.js CI (EOL: 2023-04-30)" 9 | 10 | on: 11 | push: 12 | branches: [ master ] 13 | pull_request: 14 | branches: [ master ] 15 | 16 | jobs: 17 | build: 18 | 19 | runs-on: ubuntu-latest 20 | 21 | strategy: 22 | matrix: 23 | # The package-lock.json use version 3 of the file format, which is 24 | # [incompatible][1] with npm 6.x (distibuted with node 8.x - 14.x). 25 | # 26 | # [1]: https://docs.npmjs.com/cli/v9/configuring-npm/package-lock-json#lockfileversion 27 | node-version: [ 14.x, 12.x, 10.x, 8.x ] 28 | 29 | steps: 30 | - uses: actions/checkout@v4 31 | - name: Use Node.js ${{ matrix.node-version }} 32 | uses: actions/setup-node@v4 33 | with: 34 | node-version: ${{ matrix.node-version }} 35 | # Ideally, `npm ci` would be run. However, that command [fails][1] because 36 | # lockfileVersion@3 is in use. `npm install` is run as a workaround. 37 | # 38 | # [1]: https://stackoverflow.com/questions/76253884/npm-ci-command-failing-with-cannot-read-property-angular-animations-of-undef 39 | - run: npm install 40 | - run: npm test 41 | -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The `passport-http-bearer` module provides a {@link https://www.passportjs.org/ Passport} 3 | * strategy for authenticating {@link https://www.passportjs.org/concepts/bearer-token/ bearer tokens} 4 | * used in accordance with the HTTP Bearer authentication scheme. 5 | * 6 | * Bearer tokens are a credential which can be used by any party in possession 7 | * of the token to gain access to a protected resource. Use of a bearer token 8 | * does not require any additional credentials, such as a cryptographic key. As 9 | * such, bearer tokens must be protected from disclosure in both storage and 10 | * transport in order to be utilized securely. 11 | * 12 | * The Bearer authentication scheme is specified by {@link https://www.rfc-editor.org/rfc/rfc6750 RFC 6750}. 13 | * This scheme was designed for use with access tokens issued using {@link https://www.passportjs.org/concepts/oauth2/ OAuth 2.0} 14 | * ({@link https://www.rfc-editor.org/rfc/rfc6749 RFC 6749}). However, this 15 | * scheme is useable within the general HTTP Authentication framework ({@link https://www.rfc-editor.org/rfc/rfc7235 RFC 7235}) 16 | * and can be utilized to authenticate bearer tokens issued via other mechanisms 17 | * as well. 18 | * 19 | * @module passport-http-bearer 20 | */ 21 | 22 | 23 | // Module dependencies. 24 | var Strategy = require('./strategy'); 25 | 26 | /* 27 | * `{@link Strategy}` constructor. 28 | * 29 | * @type {function} 30 | */ 31 | exports = module.exports = Strategy; 32 | 33 | /* 34 | * `{@link Strategy}` constructor. 35 | * 36 | * @type {function} 37 | */ 38 | exports.Strategy = Strategy; 39 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "passport-http-bearer", 3 | "version": "1.0.1", 4 | "description": "HTTP Bearer authentication strategy for Passport.", 5 | "keywords": [ 6 | "passport", 7 | "auth", 8 | "authn", 9 | "authentication", 10 | "authz", 11 | "authorization", 12 | "http", 13 | "bearer", 14 | "token", 15 | "oauth" 16 | ], 17 | "author": { 18 | "name": "Jared Hanson", 19 | "email": "jaredhanson@gmail.com", 20 | "url": "https://www.jaredhanson.me/" 21 | }, 22 | "repository": { 23 | "type": "git", 24 | "url": "git://github.com/jaredhanson/passport-http-bearer.git" 25 | }, 26 | "bugs": { 27 | "url": "https://github.com/jaredhanson/passport-http-bearer/issues" 28 | }, 29 | "funding": { 30 | "type": "github", 31 | "url": "https://github.com/sponsors/jaredhanson" 32 | }, 33 | "license": "MIT", 34 | "licenses": [ 35 | { 36 | "type": "MIT", 37 | "url": "https://opensource.org/licenses/MIT" 38 | } 39 | ], 40 | "main": "./lib", 41 | "dependencies": { 42 | "passport-strategy": "1.x.x" 43 | }, 44 | "devDependencies": { 45 | "make-node": "0.4.6", 46 | "mocha": "2.x.x", 47 | "chai": "2.x.x", 48 | "chai-passport-strategy": "3.x.x" 49 | }, 50 | "engines": { 51 | "node": ">= 0.4.0" 52 | }, 53 | "scripts": { 54 | "test": "mocha --require ./test/bootstrap/node --recursive" 55 | }, 56 | "testling": { 57 | "browsers": [ 58 | "chrome/latest" 59 | ], 60 | "harness": "mocha", 61 | "files": [ 62 | "test/bootstrap/testling.js", 63 | "test/*.test.js" 64 | ] 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /.github/workflows/nvm.yml: -------------------------------------------------------------------------------- 1 | name: Node.js NVM 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | env: 14 | ADDITIONAL_PARAMETERS: --without-snapshot 15 | CFLAGS: -O2 16 | CXXFLAGS: -O2 17 | 18 | strategy: 19 | matrix: 20 | # node-version: [ '0.8.x', '0.6.x' ] 21 | node-version: [ '0.8.x' ] 22 | 23 | steps: 24 | - run: sudo apt-get install -y python2.7 25 | - run: ls /usr/bin/p* 26 | - run: ls -la /usr/bin/python 27 | - run: sudo ln -fs /usr/bin/python2.7 /usr/bin/python 28 | - run: ls -la /usr/bin/python 29 | - run: python --version 30 | - run: ulimit -v unlimited 31 | #- run: export PYTHON=/usr/bin/python2.7 32 | - uses: actions/checkout@v4 33 | #- run: export CFLAGS=-O2 34 | #- run: export CXXFLAGS=-O2 35 | - run: echo $CFLAGS 36 | - run: echo $CXXFLAGS 37 | #- run: export ADDITIONAL_PARAMETERS=--without-snapshot 38 | #- run: export ADDITIONAL_PARAMETERS=CFLAGS='-O2' CXXFLAGS='-O2' 39 | - run: echo $ADDITIONAL_PARAMETERS 40 | - name: Use Node.js ${{ matrix.node-version }} 41 | uses: dcodeIO/setup-node-nvm@v5 42 | with: 43 | node-version: ${{ matrix.node-version }} 44 | node-mirror: https://nodejs.org/dist 45 | - run: sudo apt-get install -y stunnel 46 | - run: stunnel etc/stunnel.conf 47 | - run: npm config set registry="http://registry.npmjs.org/" 48 | - run: npm config set proxy http://localhost:8080 49 | - run: npm install 50 | - run: npm test 51 | #- run: which nvm 52 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ** READ THIS FIRST! ** 2 | 3 | #### Are you implementing a new feature? 4 | 5 | Requests for new features should first be discussed on the [developer forum](https://github.com/passport/develop). 6 | This allows the community to gather feedback and assess whether or not there is 7 | an existing way to achieve the desired functionality. 8 | 9 | If it is determined that a new feature needs to be implemented, include a link 10 | to the relevant discussion along with the pull request. 11 | 12 | #### Is this a security patch? 13 | 14 | Do not open pull requests that might have security implications. Potential 15 | security vulnerabilities should be reported privately to jaredhanson@gmail.com. 16 | Once any vulerabilities have been repaired, the details will be disclosed 17 | publicly in a responsible manner. This also allows time for coordinating with 18 | affected parties in order to mitigate negative consequences. 19 | 20 | 21 | If neither of the above two scenarios apply to your situation, you should open 22 | a pull request. Delete this paragraph and the text above, and fill in the 23 | information requested below. 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | ### Checklist 33 | 34 | 35 | 36 | 37 | - [ ] I have read the [CONTRIBUTING](https://github.com/jaredhanson/passport-http-bearer/blob/master/CONTRIBUTING.md) guidelines. 38 | - [ ] I have added test cases which verify the correct operation of this feature or patch. 39 | - [ ] I have added documentation pertaining to this feature or patch. 40 | - [ ] The automated test suite (`$ make test`) executes successfully. 41 | - [ ] The automated code linting (`$ make lint`) executes successfully. 42 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ** READ THIS FIRST! ** 2 | 3 | #### Are you looking for help? 4 | 5 | Reminder: The issue tracker is not a support forum. 6 | 7 | Issues should only be filed in this project once they are able to be reproduced 8 | and confirmed as a flaw in the software or incorrect information in associated 9 | documention. 10 | 11 | If you are encountering problems integrating this module into your application, 12 | please post a question on the [discussion forum](https://github.com/passport/discuss) 13 | rather than filing an issue. 14 | 15 | #### Is this a security issue? 16 | 17 | Do not open issues that might have security implications. Potential security 18 | vulnerabilities should be reported privately to jaredhanson@gmail.com. Once any 19 | vulerabilities have been repaired, the details will be disclosed publicly in a 20 | responsible manner. This also allows time for coordinating with affected parties 21 | in order to mitigate negative consequences. 22 | 23 | 24 | If neither of the above two scenarios apply to your situation, you should open 25 | an issue. Delete this paragraph and the text above, and fill in the information 26 | requested below. 27 | 28 | 29 | 30 | 31 | 32 | 33 | ### Expected behavior 34 | 35 | 36 | 37 | ### Actual behavior 38 | 39 | 40 | 41 | ### Steps to reproduce 42 | 43 | 44 | 45 | ```js 46 | // Format code using Markdown code blocks 47 | ``` 48 | 49 | ### Environment 50 | 51 | * Operating System: 52 | * Node version: 53 | * passport version: 54 | * passport-http-bearer version: 55 | -------------------------------------------------------------------------------- /.github/workflows/nvm-manual.yml: -------------------------------------------------------------------------------- 1 | name: Node.js NVM Manual 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | env: 14 | NVM_NODEJS_ORG_MIRROR: https://nodejs.org/dist 15 | # ADDITIONAL_PARAMETERS: --without-snapshot 16 | # CFLAGS: -O2 17 | # CXXFLAGS: -I/foo/openssl 18 | # CXXFLAGS: -I/home/runner/.nvm/.cache/src/node-v0.6.21/files/deps/openssl/include 19 | 20 | # https://github.com/nodejs/node-gyp/blob/main/docs/Linking-to-OpenSSL.md 21 | strategy: 22 | matrix: 23 | # node-version: [ '0.8.x', '0.6.x' ] 24 | node-version: [ '0.6.x' ] 25 | 26 | # https://groups.google.com/g/mailing.openssl.users/c/Qi5yYi8ZzPo 27 | # https://github.com/openssl/openssl/blob/master/INSTALL.md 28 | steps: 29 | - run: echo $PWD 30 | - run: ls 31 | - run: ls /usr/local 32 | - run: wget https://www.openssl.org/source/openssl-0.9.8r.tar.gz 33 | - run: ls 34 | - run: tar xvzf openssl-0.9.8r.tar.gz 35 | - name: Build OpenSSL 36 | working-directory: ./openssl-0.9.8r 37 | run: | 38 | ./config 39 | make 40 | sudo make install_sw 41 | #- run: apt list -a libssl-dev 42 | - run: ls /usr/local 43 | - run: ls /usr/local/ssl 44 | - run: ls /usr/local/ssl/lib 45 | - run: sudo apt-get update 46 | #- run: sudo apt-get install libssl1.1 47 | - run: sudo apt-get install -y python2.7 48 | #- run: sudo apt-get install -y libssl-dev 49 | #- run: ls /usr/include 50 | #- run: ls /usr/bin/p* 51 | #- run: ls -la /usr/bin/python 52 | - run: sudo ln -fs /usr/bin/python2.7 /usr/bin/python 53 | #- run: ls -la /usr/bin/python 54 | #- run: python --version 55 | - uses: actions/checkout@v4 56 | - run: echo $PWD 57 | - run: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash 58 | - run: . $HOME/.nvm/nvm.sh && nvm install 0.6 --without-snapshot --openssl-includes=/usr/local/ssl/include --openssl-libpath=/usr/local/ssl/lib 59 | #- run: . $HOME/.nvm/nvm.sh && nvm install 0.6 --without-snapshot --without-ssl 60 | #- run: which nvm 61 | - run: npm install 62 | - run: npm test 63 | 64 | -------------------------------------------------------------------------------- /.github/workflows/node.js.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs 3 | # https://github.com/actions/starter-workflows/blob/main/ci/node.js.yml 4 | 5 | name: Node.js CI 6 | 7 | on: 8 | push: 9 | branches: [ master ] 10 | pull_request: 11 | branches: [ master ] 12 | 13 | jobs: 14 | build: 15 | 16 | runs-on: ubuntu-latest 17 | 18 | strategy: 19 | matrix: 20 | node-version: 21 | - current 22 | - 22.x 23 | - 20.x 24 | - 18.x 25 | - 16.x 26 | # - 14.x 27 | - 8.x 28 | - 6.x 29 | 30 | steps: 31 | - uses: actions/checkout@v4 32 | 33 | - id: setup-node 34 | name: Use Node.js ${{ matrix.node-version }} 35 | uses: actions/setup-node@v4 36 | with: 37 | node-version: ${{ matrix.node-version }} 38 | 39 | - id: node-v 40 | name: Output Node.js version 41 | run: echo "version=$(node -v)" >> $GITHUB_OUTPUT 42 | 43 | - id: node-version 44 | name: Parse Node.js version 45 | uses: apexskier/github-semver-parse@v1 46 | with: 47 | version: ${{ steps.node-v.outputs.version }} 48 | 49 | - run: which jq 50 | 51 | - env: 52 | N_MAJOR: ${{steps.node-version.outputs.major}} 53 | N_MINOR: ${{steps.node-version.outputs.minor}} 54 | run: echo "node - $N_MAJOR $N_MINOR" 55 | 56 | - id: npm-v 57 | name: Output npm version 58 | run: echo "version=$(npm -v)" >> $GITHUB_OUTPUT 59 | 60 | - id: npm-version 61 | name: Parse npm version 62 | uses: apexskier/github-semver-parse@v1 63 | with: 64 | version: ${{ steps.npm-v.outputs.version }} 65 | 66 | - env: 67 | N_MAJOR: ${{steps.npm-version.outputs.major}} 68 | N_MINOR: ${{steps.npm-version.outputs.minor}} 69 | run: echo "npm - $N_MAJOR $N_MINOR" 70 | 71 | - id: lockfile-version 72 | name: Get package-lock.json lockfileVersion 73 | run: echo "version=$(cat package-lock.json | jq '.lockfileVersion')" >> $GITHUB_OUTPUT 74 | 75 | - env: 76 | N_MAJOR: ${{steps.lockfile-version.outputs.version}} 77 | run: echo "lockfile - $N_MAJOR" 78 | 79 | - run: npm ci 80 | # The [`ci`][1] command was [introduced][2] with npm 6.x, and is intended 81 | # to be used in continuous integration environments. If npm 6.x or later 82 | # is available, `npm ci` is executed to install dependencies. Otherwise, 83 | # `npm install` is executed. 84 | # 85 | # [1]: https://docs.npmjs.com/cli/v10/commands/npm-ci 86 | # [2]: https://blog.npmjs.org/post/171556855892/introducing-npm-ci-for-faster-more-reliable 87 | if: steps.npm-version.outputs.major >= 6 88 | 89 | - run: npm install 90 | if: steps.npm-version.outputs.major < 6 91 | 92 | - run: npm test 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # passport-http-bearer 2 | 3 | HTTP Bearer authentication strategy for [Passport](https://www.passportjs.org/). 4 | 5 | This module lets you authenticate HTTP requests using [bearer tokens](https://www.passportjs.org/concepts/bearer-token/), 6 | as specified by [RFC 6750](https://www.rfc-editor.org/rfc/rfc6750), in your 7 | Node.js applications. By plugging into Passport, bearer token support can be 8 | easily and unobtrusively integrated into any application or framework that 9 | supports [Connect](https://github.com/senchalabs/connect#readme)-style 10 | middleware, including [Express](https://expressjs.com/). 11 | 12 |
22 | Advertisement
23 |
24 | Node.js, Express, MongoDB & More: The Complete Bootcamp 2020
Master Node by building a real-world RESTful API and web app (with authentication, Node.js security, payments & more)
25 |