Skip to content

Commit

Permalink
Update to new plugin infrastructure (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed Aug 28, 2018
1 parent 533f830 commit 1c4fde3
Show file tree
Hide file tree
Showing 13 changed files with 909 additions and 3,053 deletions.
4 changes: 0 additions & 4 deletions packages/authentication-jwt/.babelrc

This file was deleted.

6 changes: 1 addition & 5 deletions packages/authentication-jwt/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,4 @@ node_modules
# Users Environment Variables
.lock-wscript

# The compiled/babelified modules
lib/

# Yarn lockfile
yarn.lock
dist/
6 changes: 2 additions & 4 deletions packages/authentication-jwt/.istanbul.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
verbose: false
instrumentation:
root: ./src/
excludes:
- lib/
root: ./lib/
include-all-sources: true
reporting:
print: summary
Expand All @@ -14,4 +12,4 @@ reporting:
statements: [50, 80]
lines: [50, 80]
functions: [50, 80]
branches: [50, 80]
branches: [50, 80]
5 changes: 3 additions & 2 deletions packages/authentication-jwt/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.istanbul.yml
.babelrc
.idea/
src/
.vscode/
test/
!lib/
coverage/
.github/
1 change: 0 additions & 1 deletion packages/authentication-jwt/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: node_js
node_js:
- node
- '6'
- '4'
addons:
code_climate:
repo_token: 7b5edc43d3ae8424cdc25360173f80638fc9da279f597b9c8eb8df2bd4ede0a7
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Debug from 'debug';
import merge from 'lodash.merge';
import omit from 'lodash.omit';
import pick from 'lodash.pick';
import DefaultVerifier from './verifier';
import { Strategy as JWTStrategy, ExtractJwt } from 'passport-jwt';
const Debug = require('debug');
const merge = require('lodash.merge');
const omit = require('lodash.omit');
const pick = require('lodash.pick');
const DefaultVerifier = require('./verifier');
const passportJwt = require('passport-jwt');

const debug = Debug('feathers-authentication-jwt');
const defaults = {
Expand All @@ -21,10 +21,11 @@ const KEYS = [
'jwt'
];

export default function init (options = {}) {
module.exports = function init (options = {}) {
return function jwtAuth () {
const app = this;
const _super = app.setup;
const { ExtractJwt, Strategy } = passportJwt;

if (!app.passport) {
throw new Error(`Can not find app.passport. Did you initialize feathers-authentication before feathers-authentication-jwt?`);
Expand Down Expand Up @@ -76,17 +77,17 @@ export default function init (options = {}) {

// Register 'jwt' strategy with passport
debug('Registering jwt authentication strategy with options:', strategyOptions);
app.passport.use(jwtSettings.name, new JWTStrategy(strategyOptions, verifier.verify.bind(verifier)));
app.passport.use(jwtSettings.name, new Strategy(strategyOptions, verifier.verify.bind(verifier)));
app.passport.options(jwtSettings.name, jwtSettings);

return result;
};
};
}
};

// Exposed Modules
Object.assign(init, {
Object.assign(module.exports, {
defaults,
ExtractJwt,
ExtractJwt: passportJwt.ExtractJwt,
Verifier: DefaultVerifier
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Debug from 'debug';

const Debug = require('debug');
const debug = Debug('feathers-authentication-jwt:verify');

class JWTVerifier {
Expand Down Expand Up @@ -38,4 +37,4 @@ class JWTVerifier {
}
}

export default JWTVerifier;
module.exports = JWTVerifier;
2 changes: 0 additions & 2 deletions packages/authentication-jwt/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
--recursive test/
--compilers js:babel-core/register
--require babel-polyfill
Loading

0 comments on commit 1c4fde3

Please sign in to comment.