All Projects → jaredhanson → Passport Strategy

jaredhanson / Passport Strategy

Licence: mit
An abstract class implementing Passport's strategy API.

Labels

Projects that are alternatives of or similar to Passport Strategy

K8s Mediaserver Operator
Repository for k8s Mediaserver Operator project
Stars: ✭ 81 (-3.57%)
Mutual labels:  makefile
Ont Assembly Polish
ONT assembly and Illumina polishing pipeline
Stars: ✭ 82 (-2.38%)
Mutual labels:  makefile
Kodi Standalone Service
A systemd service to allow for standalone operation of kodi.
Stars: ✭ 83 (-1.19%)
Mutual labels:  makefile
Corteza Docs
Documentation, manual, instructions
Stars: ✭ 81 (-3.57%)
Mutual labels:  makefile
Avrqueue
Queueing Library for AVR and Arduino
Stars: ✭ 81 (-3.57%)
Mutual labels:  makefile
Op Build
Buildroot overlay for Open Power
Stars: ✭ 82 (-2.38%)
Mutual labels:  makefile
Openwrt Kcptun
kcptun for OpenWrt
Stars: ✭ 80 (-4.76%)
Mutual labels:  makefile
Ergodone
ErgoDox using pro micro. Original work by Dox. Brainhole association present
Stars: ✭ 84 (+0%)
Mutual labels:  makefile
Dokku Wordpress
A simple repository that will guide you through deploying wordpress on dokku
Stars: ✭ 82 (-2.38%)
Mutual labels:  makefile
Sqlite3 Android
SQLite CLI and Library build scripts for Android
Stars: ✭ 83 (-1.19%)
Mutual labels:  makefile
Openwrt Simple Obfs
Simple-obfs for OpenWrt/LEDE
Stars: ✭ 81 (-3.57%)
Mutual labels:  makefile
Openwrt Vlmcsd
a package for vlmcsd
Stars: ✭ 81 (-3.57%)
Mutual labels:  makefile
Vala Object
Use Vala from Ruby, Python, Lua, JavaScript (Node.js, gjs, seed) and many other languages
Stars: ✭ 82 (-2.38%)
Mutual labels:  makefile
Learn machine learning
Road to Machine Learning
Stars: ✭ 81 (-3.57%)
Mutual labels:  makefile
Device Sony Yuga
Stars: ✭ 83 (-1.19%)
Mutual labels:  makefile
Awesome Blogdown
An awesome curated list of blogs built using blogdown
Stars: ✭ 80 (-4.76%)
Mutual labels:  makefile
Make Docker Command
Seamlessly execute commands (composer, bower, compass) in isolation using docker and make.
Stars: ✭ 82 (-2.38%)
Mutual labels:  makefile
Deep Base
Deep learning base image for Docker (Tensorflow, Caffe, MXNet, Torch, Openface, etc.)
Stars: ✭ 84 (+0%)
Mutual labels:  makefile
Riscv Sbi Doc
Documentation for the RISC-V Supervisor Binary Interface
Stars: ✭ 84 (+0%)
Mutual labels:  makefile
Wiki
Archive of free60.org mediawiki
Stars: ✭ 83 (-1.19%)
Mutual labels:  makefile

passport-strategy

Build Coverage Quality Dependencies Tips

An abstract class implementing Passport'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:

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.

CustomStrategy.prototype.authenticate = function(req, options) {
  // TODO: authenticate request
}

Augmented Methods

The Strategy.authenticate method is called on an instance of this Strategy that's augmented with the following action functions.
These action functions are bound via closure the the request/response pair.
The end goal of the strategy is to invoke one of these action methods, in order to indicate successful or failed authentication, redirect to a third-party identity provider, etc.

strategy.success(user, info)

Authenticate user, with optional info.

Strategies should call this function to successfully authenticate a user. user should be an object supplied by the application after it has been given an opportunity to verify credentials. info is an optional argument containing additional user information. This is useful for third-party authentication strategies to pass profile details.

Kind: instance method of Strategy
Api: public

Param Type
user Object
info Object
strategy.fail(challenge, status)

Fail authentication, with optional challenge and status, defaulting to 401.

Strategies should call this function to fail an authentication attempt.

Kind: instance method of Strategy
Api: public

Param Type
challenge String
status Number
strategy.redirect(url, status)

Redirect to url with optional status, defaulting to 302.

Strategies should call this function to redirect the user (via their user agent) to a third-party website for authentication.

Kind: instance method of Strategy
Api: public

Param Type
url String
status Number
strategy.pass()

Pass without making a success or fail decision.

Under most circumstances, Strategies should not need to call this function. It exists primarily to allow previous authentication state to be restored, for example from an HTTP session.

Kind: instance method of Strategy
Api: public

strategy.error(err)

Internal error while performing authentication.

Strategies should call this function when an internal error occurs during the process of performing authentication; for example, if the user directory is not available.

Kind: instance method of Strategy
Api: public

Param Type
err Error

Related Modules

Tests

$ npm install
$ npm test

Credits

License

The MIT License

Copyright (c) 2011-2014 Jared Hanson <http://jaredhanson.net/>

Sponsor

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].