pax_global_header00006660000000000000000000000064121765450500014517gustar00rootroot0000000000000052 comment=82638ca28b0ab1c607f61a5cad39df3a28424176 passport-strategy-1.0.0/000077500000000000000000000000001217654505000152305ustar00rootroot00000000000000passport-strategy-1.0.0/.gitignore000066400000000000000000000001121217654505000172120ustar00rootroot00000000000000build reports # Mac OS X .DS_Store # Node.js node_modules npm-debug.log passport-strategy-1.0.0/.jshintrc000066400000000000000000000004611217654505000170560ustar00rootroot00000000000000{ "node": true, "bitwise": true, "camelcase": true, "curly": true, "forin": true, "immed": true, "latedef": true, "newcap": true, "noarg": true, "noempty": true, "nonew": true, "quotmark": "single", "undef": true, "unused": true, "trailing": true, "laxcomma": true } passport-strategy-1.0.0/.npmignore000066400000000000000000000002271217654505000172300ustar00rootroot00000000000000README.md Makefile build/ docs/ examples/ reports/ support/ test/ # Mac OS X .DS_Store # Node.js .npmignore node_modules/ npm-debug.log # Git .git* passport-strategy-1.0.0/.travis.yml000066400000000000000000000003441217654505000173420ustar00rootroot00000000000000language: "node_js" node_js: - "0.4" - "0.6" - "0.8" - "0.10" before_install: - "npm install istanbul -g" - "npm install coveralls -g" script: "make ci-travis" after_success: - "make submit-coverage-to-coveralls" passport-strategy-1.0.0/LICENSE000066400000000000000000000020701217654505000162340ustar00rootroot00000000000000(The MIT License) Copyright (c) 2011-2013 Jared Hanson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. passport-strategy-1.0.0/Makefile000066400000000000000000000027551217654505000167010ustar00rootroot00000000000000SOURCES = lib/*.js TESTS = test/*.test.js lint: lint-jshint test: test-mocha test-cov: test-istanbul-mocha view-cov: view-istanbul-report # ============================================================================== # Node.js # ============================================================================== include support/mk/node.mk include support/mk/mocha.mk # ============================================================================== # Browserify # ============================================================================== BROWSERIFY_MAIN = ./lib/index.js include support/mk/browserify.mk include support/mk/testling.mk # ============================================================================== # Code Quality # ============================================================================== include support/mk/notes.mk include support/mk/jshint.mk include support/mk/istanbul.mk # ============================================================================== # Continuous Integration # ============================================================================== include support/mk/coveralls.mk ci-travis: test test-cov submit-coverage-to-coveralls: submit-istanbul-lcov-to-coveralls # ============================================================================== # Clean # ============================================================================== clean: rm -rf build rm -rf reports clobber: clean clobber-node .PHONY: lint test test-cov view-cov ci-travis clean clobber passport-strategy-1.0.0/README.md000066400000000000000000000031431217654505000165100ustar00rootroot00000000000000# passport-strategy [![Build](https://travis-ci.org/jaredhanson/passport-strategy.png)](http://travis-ci.org/jaredhanson/passport-strategy) [![Coverage](https://coveralls.io/repos/jaredhanson/passport-strategy/badge.png)](https://coveralls.io/r/jaredhanson/passport-strategy) [![Dependencies](https://david-dm.org/jaredhanson/passport-strategy.png)](http://david-dm.org/jaredhanson/passport-strategy) An abstract class implementing [Passport](http://passportjs.org/)'s strategy API. ## Install $ npm install passport-strategy ## Usage This module exports an abstract `Strategy` class that is intended to be subclassed when implementing concrete authentication strategies. Once implemented, such strategies can be used by applications that utilize Passport middleware for authentication. #### Subclass Strategy Create a new `CustomStrategy` constructor which inherits from `Strategy`: ```javascript var util = require('util') , Strategy = require('passport-strategy'); function CustomStrategy(...) { Strategy.call(this); } util.inherits(CustomStrategy, Strategy); ``` #### Implement Authentication Implement `autheticate()`, performing the necessary operations required by the authentication scheme or protocol being implemented. ```javascript CustomStrategy.prototype.authenticate = function(req, options) { // TODO: authenticate request } ``` ## Tests $ npm install $ npm test ## Credits - [Jared Hanson](http://github.com/jaredhanson) ## License [The MIT License](http://opensource.org/licenses/MIT) Copyright (c) 2011-2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> passport-strategy-1.0.0/lib/000077500000000000000000000000001217654505000157765ustar00rootroot00000000000000passport-strategy-1.0.0/lib/index.js000066400000000000000000000003371217654505000174460ustar00rootroot00000000000000/** * Module dependencies. */ var Strategy = require('./strategy'); /** * Expose `Strategy` directly from package. */ exports = module.exports = Strategy; /** * Export constructors. */ exports.Strategy = Strategy; passport-strategy-1.0.0/lib/strategy.js000066400000000000000000000010671217654505000202020ustar00rootroot00000000000000/** * Creates an instance of `Strategy`. * * @constructor * @api public */ function Strategy() { } /** * Authenticate request. * * This function must be overridden by subclasses. In abstract form, it always * throws an exception. * * @param {Object} req The request to authenticate. * @param {Object} [options] Strategy-specific options. * @api public */ Strategy.prototype.authenticate = function(req, options) { throw new Error('Strategy#authenticate must be overridden by subclass'); }; /** * Expose `Strategy`. */ module.exports = Strategy; passport-strategy-1.0.0/package.json000066400000000000000000000020421217654505000175140ustar00rootroot00000000000000{ "name": "passport-strategy", "version": "1.0.0", "description": "An abstract class implementing Passport's strategy API.", "keywords": [ "passport", "strategy" ], "repository": { "type": "git", "url": "git://github.com/jaredhanson/passport-strategy.git" }, "bugs": { "url": "http://github.com/jaredhanson/passport-strategy/issues" }, "author": { "name": "Jared Hanson", "email": "jaredhanson@gmail.com", "url": "http://www.jaredhanson.net/" }, "licenses": [ { "type": "MIT", "url": "http://www.opensource.org/licenses/MIT" } ], "main": "./lib", "dependencies": { }, "devDependencies": { "mocha": "1.x.x", "chai": "1.x.x" }, "engines": { "node": ">= 0.4.0" }, "scripts": { "test": "node_modules/.bin/mocha --reporter spec --require test/bootstrap/node test/*.test.js" }, "testling": { "browsers": [ "chrome/latest" ], "harness" : "mocha", "files": [ "test/bootstrap/testling.js", "test/*.test.js" ] } } passport-strategy-1.0.0/support/000077500000000000000000000000001217654505000167445ustar00rootroot00000000000000passport-strategy-1.0.0/support/mk/000077500000000000000000000000001217654505000173535ustar00rootroot00000000000000passport-strategy-1.0.0/support/mk/browserify.mk000066400000000000000000000003311217654505000220740ustar00rootroot00000000000000BROWSERIFY ?= browserify BROWSERIFY_MAIN ?= index.js BROWSERIFY_OUT ?= build/bundle.js build-browserify: node_modules mkdir -p build $(BROWSERIFY) $(BROWSERIFY_MAIN) -o $(BROWSERIFY_OUT) .PHONY: build-browserify passport-strategy-1.0.0/support/mk/coveralls.mk000066400000000000000000000002261217654505000216760ustar00rootroot00000000000000COVERALLS ?= coveralls submit-istanbul-lcov-to-coveralls: cat $(ISTANBUL_LCOV_INFO_PATH) | $(COVERALLS) .PHONY: submit-istanbul-lcov-to-coveralls passport-strategy-1.0.0/support/mk/istanbul.mk000066400000000000000000000010321217654505000215210ustar00rootroot00000000000000ISTANBUL ?= istanbul ISTANBUL_OUT ?= ./reports/coverage ISTANBUL_REPORT ?= lcov ISTANBUL_HTML_REPORT_PATH ?= $(ISTANBUL_OUT)/lcov-report/index.html ISTANBUL_LCOV_INFO_PATH ?= $(ISTANBUL_OUT)/lcov.info test-istanbul-mocha: node_modules NODE_PATH=$(NODE_PATH_TEST) \ $(ISTANBUL) cover \ --dir $(ISTANBUL_OUT) --report $(ISTANBUL_REPORT) \ $(_MOCHA) -- \ --reporter $(MOCHA_REPORTER) \ --require $(MOCHA_REQUIRE) $(TESTS) view-istanbul-report: open $(ISTANBUL_HTML_REPORT_PATH) .PHONY: test-istanbul-mocha view-istanbul-report passport-strategy-1.0.0/support/mk/jshint.mk000066400000000000000000000001131217654505000211760ustar00rootroot00000000000000JSHINT ?= jshint lint-jshint: $(JSHINT) $(SOURCES) .PHONY: lint-jshint passport-strategy-1.0.0/support/mk/mocha.mk000066400000000000000000000004471217654505000210000ustar00rootroot00000000000000MOCHA ?= ./node_modules/.bin/mocha _MOCHA ?= ./node_modules/.bin/_mocha MOCHA_REPORTER ?= spec MOCHA_REQUIRE ?= ./test/bootstrap/node test-mocha: node_modules NODE_PATH=$(NODE_PATH_TEST) \ $(MOCHA) \ --reporter $(MOCHA_REPORTER) \ --require $(MOCHA_REQUIRE) $(TESTS) .PHONY: test-mocha passport-strategy-1.0.0/support/mk/node.mk000066400000000000000000000001261217654505000206300ustar00rootroot00000000000000node_modules: npm install clobber-node: rm -rf node_modules .PHONY: clobber-node passport-strategy-1.0.0/support/mk/notes.mk000066400000000000000000000001261217654505000210330ustar00rootroot00000000000000NOTES ?= 'TODO|FIXME' notes: grep -Ern $(NOTES) $(SOURCES) $(TESTS) .PHONY: notes passport-strategy-1.0.0/support/mk/testling.mk000066400000000000000000000001271217654505000215350ustar00rootroot00000000000000TESTLING ?= testling test-testling: node_modules $(TESTLING) .PHONY: test-testling passport-strategy-1.0.0/test/000077500000000000000000000000001217654505000162075ustar00rootroot00000000000000passport-strategy-1.0.0/test/bootstrap/000077500000000000000000000000001217654505000202245ustar00rootroot00000000000000passport-strategy-1.0.0/test/bootstrap/node.js000066400000000000000000000000721217654505000215060ustar00rootroot00000000000000var chai = require('chai'); global.expect = chai.expect; passport-strategy-1.0.0/test/bootstrap/testling.js000066400000000000000000000000721217654505000224120ustar00rootroot00000000000000var chai = require('chai'); window.expect = chai.expect; passport-strategy-1.0.0/test/module.test.js000066400000000000000000000005721217654505000210140ustar00rootroot00000000000000var strategy = require('..'); describe('passport-strategy', function() { it('should export Strategy constructor directly from package', function() { expect(strategy).to.be.a('function'); expect(strategy).to.equal(strategy.Strategy); }); it('should export Strategy constructor', function() { expect(strategy.Strategy).to.be.a('function'); }); }); passport-strategy-1.0.0/test/strategy.test.js000066400000000000000000000005011217654505000213610ustar00rootroot00000000000000var Strategy = require('../lib/strategy'); describe('Strategy', function() { var strategy = new Strategy(); it('authenticate should throw error', function() { expect(function() { strategy.authenticate() }).to.throw(Error, 'Strategy#authenticate must be overridden by subclass'); }); });