feathers-authentication-custom
Custom authentication strategy for feathers-authentication using Passport
Installation
npm install feathers-authentication-custom --save
API
This module is a wrapper around the passport-custom strategy which allows you implement a custom verifier function for authenticating requests.
Main Initialization
In most cases initializing the feathers-authentication-custom
module is as simple as doing this:
app;app;
If you use a function declaration instead of an arrow =>
function, then you can use this.app
to get a reference to the app object:
{ thisapp === app; //-> true}app;app;
Verifier class
In more advanced scenarios you can use a Verifier class. This should be familiar to you if you have ever used a custom verifier class with other passport strategies. The class should implement the following methods:
{} // the class constructor {} // performs custom verification; app;app;
Expected Request Data
By default, this strategy expects a payload in this format:
strategy: 'custom'
Complete Example
Here's a basic example of a Feathers server that uses feathers-authentication-jwt
. You can see a fully working example in the example/ directory.
const feathers = ;const rest = ;const hooks = ;const memory = ;const bodyParser = ;const errorHandler = ;const auth = ;const custom = ; { // perform custom verifications ;} // Initialize the applicationconst app = // Needed for parsing bodies (login) // Configure feathers-authentication ; app; console;
License
Copyright (c) 2016
Licensed under the MIT license.